From 50a3a7cf612612fcafe1e3a433ef5184fdcb0ea1 Mon Sep 17 00:00:00 2001 From: Tsimafei Harhun Date: Mon, 15 Jul 2019 12:11:45 +0300 Subject: [PATCH] Swift 4.2 --- PinterestLayout.xcodeproj/project.pbxproj | 9 +++++---- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ PinterestLayout/Help.swift | 2 +- PinterestLayout/PinterestCell.swift | 4 ++-- PinterestLayout/PinterestLayout.swift | 4 ++-- PinterestLayoutExample/AppDelegate.swift | 2 +- 6 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 PinterestLayout.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/PinterestLayout.xcodeproj/project.pbxproj b/PinterestLayout.xcodeproj/project.pbxproj index 07e4e8d..7d953f2 100644 --- a/PinterestLayout.xcodeproj/project.pbxproj +++ b/PinterestLayout.xcodeproj/project.pbxproj @@ -270,6 +270,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -482,7 +483,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -503,7 +504,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.magiclab.PinterestLayout; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -518,7 +519,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.magiclab.PinterestLayoutExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -533,7 +534,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.magiclab.PinterestLayoutExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/PinterestLayout.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/PinterestLayout.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/PinterestLayout.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/PinterestLayout/Help.swift b/PinterestLayout/Help.swift index 4bb28b0..3861583 100644 --- a/PinterestLayout/Help.swift +++ b/PinterestLayout/Help.swift @@ -38,7 +38,7 @@ public extension String { let rect = NSString(string: self).boundingRect( with: CGSize(width: width, height: CGFloat(MAXFLOAT)), options: .usesLineFragmentOrigin, - attributes: [NSFontAttributeName: font], + attributes: [NSAttributedString.Key.font: font], context: nil ) return ceil(rect.height) diff --git a/PinterestLayout/PinterestCell.swift b/PinterestLayout/PinterestCell.swift index e6622a0..5af7d7a 100644 --- a/PinterestLayout/PinterestCell.swift +++ b/PinterestLayout/PinterestCell.swift @@ -101,7 +101,7 @@ extension PinterestCell { attribute: .top, relatedBy: .equal, toItem: roundedCornersView, - attribute: NSLayoutAttribute.top, + attribute: NSLayoutConstraint.Attribute.top, multiplier: 1, constant: 0 ) @@ -188,7 +188,7 @@ extension PinterestCell { multiplier: 1, constant: PinterestCell.annotationPadding ) - bottomConstraint.priority = 750 + bottomConstraint.priority = UILayoutPriority(rawValue: 750) roundedCornersView.addConstraint(bottomConstraint) } } diff --git a/PinterestLayout/PinterestLayout.swift b/PinterestLayout/PinterestLayout.swift index 8554de7..0ed61ca 100644 --- a/PinterestLayout/PinterestLayout.swift +++ b/PinterestLayout/PinterestLayout.swift @@ -100,7 +100,7 @@ public class PinterestLayout: UICollectionViewLayout { size: headerSize ) let headerAttributes = PinterestLayoutAttributes( - forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, + forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, with: IndexPath(item: 0, section: section) ) headerAttributes.frame = headerFrame @@ -163,7 +163,7 @@ public class PinterestLayout: UICollectionViewLayout { size: footerSize ) let footerAttributes = PinterestLayoutAttributes( - forSupplementaryViewOfKind: UICollectionElementKindSectionFooter, + forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, with: IndexPath(item: 0, section: section) ) footerAttributes.frame = footerFrame diff --git a/PinterestLayoutExample/AppDelegate.swift b/PinterestLayoutExample/AppDelegate.swift index ba480a5..b7df1d8 100644 --- a/PinterestLayoutExample/AppDelegate.swift +++ b/PinterestLayoutExample/AppDelegate.swift @@ -14,7 +14,7 @@ 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. return true }