Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify examples_extra/Shop swift 4.2 Version #1709

Merged
merged 2 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions examples_extra/Shop/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
PODS:
- PINCache (3.0.1-beta.6):
- PINCache/Arc-exception-safe (= 3.0.1-beta.6)
- PINCache/Core (= 3.0.1-beta.6)
- PINCache/Arc-exception-safe (3.0.1-beta.6):
- PINCache/Core
- PINCache/Core (3.0.1-beta.6):
- PINOperation (~> 1.1.0)
- PINOperation (1.1.2)
- PINRemoteImage/Core (3.0.0-beta.13):
- PINOperation
- PINRemoteImage/iOS (3.0.0-beta.13):
- PINRemoteImage/Core
- PINRemoteImage/PINCache (3.0.0-beta.13):
- PINCache (= 3.0.1-beta.6)
- PINRemoteImage/Core
- Texture (2.8.1):
- Texture/AssetsLibrary (= 2.8.1)
- Texture/Core (= 2.8.1)
- Texture/MapKit (= 2.8.1)
- Texture/Photos (= 2.8.1)
- Texture/PINRemoteImage (= 2.8.1)
- Texture/Video (= 2.8.1)
- Texture/AssetsLibrary (2.8.1):
- Texture/Core
- Texture/Core (2.8.1)
- Texture/MapKit (2.8.1):
- Texture/Core
- Texture/Photos (2.8.1):
- Texture/Core
- Texture/PINRemoteImage (2.8.1):
- PINRemoteImage/iOS (= 3.0.0-beta.13)
- PINRemoteImage/PINCache
- Texture/Core
- Texture/Video (2.8.1):
- Texture/Core

DEPENDENCIES:
- Texture

SPEC REPOS:
trunk:
- PINCache
- PINOperation
- PINRemoteImage
- Texture

SPEC CHECKSUMS:
PINCache: d195fdba255283f7e9900a55e3cced377f431f9b
PINOperation: 24b774353ca248fcf87d67b2d61eef42087c125a
PINRemoteImage: d6d51c5d2adda55f1ce30c96e850b6c4ebd2856a
Texture: 8ecf6984065a1e54f06bf97b349ecca28582acd7

PODFILE CHECKSUM: a2268998a00c6a146ff9e53ff921e2e99dd962fd

COCOAPODS: 1.8.3
78 changes: 10 additions & 68 deletions examples_extra/Shop/Shop.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@
278BFA1A1DD4A7B80065BACA /* Sources */,
278BFA1B1DD4A7B80065BACA /* Frameworks */,
278BFA1C1DD4A7B80065BACA /* Resources */,
7A9094E163FF7B834F7D5B76 /* [CP] Embed Pods Frameworks */,
89C7C85237928A7AA1AFD80E /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -248,8 +246,6 @@
278BFA2E1DD4A7B80065BACA /* Sources */,
278BFA2F1DD4A7B80065BACA /* Frameworks */,
278BFA301DD4A7B80065BACA /* Resources */,
4E2E9451B168505B69D5EA0F /* [CP] Embed Pods Frameworks */,
D97894A2A1E9AC5B6FFB9271 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -268,7 +264,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0810;
LastUpgradeCheck = 0910;
LastUpgradeCheck = 1110;
ORGANIZATIONNAME = Dimitri;
TargetAttributes = {
278BFA1D1DD4A7B80065BACA = {
Expand All @@ -287,7 +283,7 @@
};
buildConfigurationList = 278BFA191DD4A7B80065BACA /* Build configuration list for PBXProject "Shop" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -342,21 +338,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
4E2E9451B168505B69D5EA0F /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ShopTests/Pods-ShopTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
53B8D1D4907B5E11F1FB4D84 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -375,51 +356,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
7A9094E163FF7B834F7D5B76 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Shop/Pods-Shop-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
89C7C85237928A7AA1AFD80E /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Shop/Pods-Shop-resources.sh\"\n";
showEnvVarsInLog = 0;
};
D97894A2A1E9AC5B6FFB9271 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ShopTests/Pods-ShopTests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -480,6 +416,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand All @@ -489,13 +426,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -536,6 +475,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand All @@ -545,13 +485,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -594,7 +536,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Shop/Shop-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -610,7 +552,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.sample.Shop;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Shop/Shop-Bridging-Header.h";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
26 changes: 13 additions & 13 deletions examples_extra/Shop/Shop/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,46 @@ import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

UINavigationBar.appearance().tintColor = UIColor.white
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]
UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.white]
UINavigationBar.appearance().barTintColor = UIColor.primaryBarTintColor()

self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.backgroundColor = UIColor.white
self.window?.rootViewController = UINavigationController(rootViewController: ShopViewController())
self.window?.makeKeyAndVisible()

return true
}

func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}

func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


}

2 changes: 1 addition & 1 deletion examples_extra/Shop/Shop/Models/DummyGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private extension Array {
private extension String {
var stringWithCapitalizedFirstLetter: String {
let firstLetterRange = startIndex..<self.index(after: self.startIndex)
let capitalizedFirstLetter = substring(with: firstLetterRange).capitalized
let capitalizedFirstLetter = String(self[...self.startIndex]).capitalized
return replacingCharacters(in: firstLetterRange, with: capitalizedFirstLetter)
}
}
10 changes: 5 additions & 5 deletions examples_extra/Shop/Shop/Scenes/Product/ProductNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ProductNode: ASDisplayNode {
}

private var titleTextAttributes = {
return [NSForegroundColorAttributeName: UIColor.black, NSFontAttributeName: UIFont.boldSystemFont(ofSize: 16)]
return [NSAttributedString.Key.foregroundColor: UIColor.black, NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 16)]
}

private func setupDescriptionNode() {
Expand All @@ -69,23 +69,23 @@ class ProductNode: ASDisplayNode {
}

private var descriptionTextAttributes = {
return [NSForegroundColorAttributeName: UIColor.darkGray, NSFontAttributeName: UIFont.systemFont(ofSize: 14)]
return [NSAttributedString.Key.foregroundColor: UIColor.darkGray, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 14)]
}

private func setupPriceNode() {
self.priceNode.attributedText = NSAttributedString(string: self.product.currency + " \(self.product.price)", attributes: self.priceTextAttributes())
}

private var priceTextAttributes = {
return [NSForegroundColorAttributeName: UIColor.red, NSFontAttributeName: UIFont.boldSystemFont(ofSize: 15)]
return [NSAttributedString.Key.foregroundColor: UIColor.red, NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 15)]
}

private func setupReviewsNode() {
self.reviewsNode.attributedText = NSAttributedString(string: "\(self.product.numberOfReviews) reviews", attributes: self.reviewsTextAttributes())
}

private var reviewsTextAttributes = {
return [NSForegroundColorAttributeName: UIColor.lightGray, NSFontAttributeName: UIFont.systemFont(ofSize: 14)]
return [NSAttributedString.Key.foregroundColor: UIColor.lightGray, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 14)]
}

// MARK: - Build node hierarchy
Expand All @@ -110,7 +110,7 @@ class ProductNode: ASDisplayNode {
let starRatingReviewsSpec = ASStackLayoutSpec(direction: .horizontal, spacing: 25.0, justifyContent: .start, alignItems: .center, children: [self.starRatingNode, self.reviewsNode])
let contentSpec = ASStackLayoutSpec(direction: .vertical, spacing: 8.0, justifyContent: .start, alignItems: .stretch, children: [titlePriceSpec, starRatingReviewsSpec, self.descriptionNode])
contentSpec.style.flexShrink = 1
let insetSpec = ASInsetLayoutSpec(insets: UIEdgeInsetsMake(12.0, 12.0, 12.0, 12.0), child: contentSpec)
let insetSpec = ASInsetLayoutSpec(insets: UIEdgeInsets(top: 12.0, left: 12.0, bottom: 12.0, right: 12.0), child: contentSpec)
let finalSpec = ASStackLayoutSpec(direction: .vertical, spacing: 5.0, justifyContent: .start, alignItems: .center, children: [self.imageNode, insetSpec])
return finalSpec
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit

class ProductCollectionNode: ASCellNode {

// MARK: - Variables

private let containerNode: ContainerNode
Expand All @@ -26,7 +26,7 @@ class ProductCollectionNode: ASCellNode {
// MARK: - Layout

override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
let insets = UIEdgeInsetsMake(2, 2, 2, 2)
let insets = UIEdgeInsets(top: 2, left: 2, bottom: 2, right: 2)
return ASInsetLayoutSpec(insets: insets, child: self.containerNode)
}

Expand All @@ -47,11 +47,11 @@ class ProductContentNode: ASDisplayNode {
imageNode.url = URL(string: product.imageURL)

titleNode = ASTextNode()
let title = NSAttributedString(string: product.title, attributes: [NSForegroundColorAttributeName: UIColor.white, NSFontAttributeName: UIFont.boldSystemFont(ofSize: 17)])
let title = NSAttributedString(string: product.title, attributes: [NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 17)])
titleNode.attributedText = title

subtitleNode = ASTextNode()
let subtitle = NSAttributedString(string: product.currency + " \(product.price)", attributes: [NSForegroundColorAttributeName: UIColor.white, NSFontAttributeName: UIFont.boldSystemFont(ofSize: 15)])
let subtitle = NSAttributedString(string: product.currency + " \(product.price)", attributes: [NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 15)])
subtitleNode.attributedText = subtitle

super.init()
Expand All @@ -65,7 +65,7 @@ class ProductContentNode: ASDisplayNode {

override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
let textNodesStack = ASStackLayoutSpec(direction: .vertical, spacing: 5, justifyContent: .end, alignItems: .stretch, children: [self.titleNode, self.subtitleNode])
let insetStack = ASInsetLayoutSpec(insets: UIEdgeInsetsMake(CGFloat.infinity, 10, 10, 10), child: textNodesStack)
let insetStack = ASInsetLayoutSpec(insets: UIEdgeInsets(top: CGFloat.infinity, left: 10, bottom: 10, right: 10), child: textNodesStack)
return ASOverlayLayoutSpec(child: self.imageNode, overlay: insetStack)
}

Expand Down
Loading