From 5abcf755d5205f00d4310ed6dfa34afbcd9c2102 Mon Sep 17 00:00:00 2001 From: Ilya Glazunov Date: Tue, 16 Mar 2021 11:03:36 +0300 Subject: [PATCH 1/2] update to swift 5 --- StickyHeaders.xcodeproj/project.pbxproj | 6 ++++-- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ StickyHeaders/AppDelegate.swift | 2 +- StickyHeaders/StickyHeadersCollectionViewFlowLayout.swift | 2 +- StickyHeaders/ViewController.swift | 4 ++-- 5 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 StickyHeaders.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/StickyHeaders.xcodeproj/project.pbxproj b/StickyHeaders.xcodeproj/project.pbxproj index 58df214..a224bb6 100644 --- a/StickyHeaders.xcodeproj/project.pbxproj +++ b/StickyHeaders.xcodeproj/project.pbxproj @@ -118,6 +118,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -280,7 +281,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.cocoacasts.StickyHeaders; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -293,7 +294,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.cocoacasts.StickyHeaders; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -316,6 +317,7 @@ CC144FEC1D9F8C95004D8E2B /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/StickyHeaders.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/StickyHeaders.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/StickyHeaders.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/StickyHeaders/AppDelegate.swift b/StickyHeaders/AppDelegate.swift index 2f25f8f..695de60 100644 --- a/StickyHeaders/AppDelegate.swift +++ b/StickyHeaders/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 } diff --git a/StickyHeaders/StickyHeadersCollectionViewFlowLayout.swift b/StickyHeaders/StickyHeadersCollectionViewFlowLayout.swift index fd7fd52..55677cf 100644 --- a/StickyHeaders/StickyHeadersCollectionViewFlowLayout.swift +++ b/StickyHeaders/StickyHeadersCollectionViewFlowLayout.swift @@ -40,7 +40,7 @@ class StickyHeadersCollectionViewFlowLayout: UICollectionViewFlowLayout { for section in sectionsToAdd { let indexPath = IndexPath(item: 0, section: section) - if let sectionAttributes = self.layoutAttributesForSupplementaryView(ofKind: UICollectionElementKindSectionHeader, at: indexPath) { + if let sectionAttributes = self.layoutAttributesForSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, at: indexPath) { newLayoutAttributes.append(sectionAttributes) } } diff --git a/StickyHeaders/ViewController.swift b/StickyHeaders/ViewController.swift index 65cfc7e..9e06d1b 100644 --- a/StickyHeaders/ViewController.swift +++ b/StickyHeaders/ViewController.swift @@ -46,7 +46,7 @@ class ViewController: UIViewController { // Register XIB for Supplementary View Reuse let XIB = UINib.init(nibName: "SectionHeader", bundle: Bundle.main) - collectionView.register(XIB, forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: HeaderIdentifier) + collectionView.register(XIB, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: HeaderIdentifier) // Add as Subview view.addSubview(collectionView) @@ -85,7 +85,7 @@ extension ViewController: UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { // Dequeue Reusable Supplementary View - if let supplementaryView = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionElementKindSectionHeader, withReuseIdentifier: HeaderIdentifier, for: indexPath) as? SectionHeader { + if let supplementaryView = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: HeaderIdentifier, for: indexPath) as? SectionHeader { // Configure Supplementary View supplementaryView.backgroundColor = .random() supplementaryView.titleLabel.text = "Section \(indexPath.section)" From 15ca2fabb5d0eb6a47db7c76a5d1fa87ebdcf871 Mon Sep 17 00:00:00 2001 From: Ilya Glazunov Date: Tue, 16 Mar 2021 11:04:05 +0300 Subject: [PATCH 2/2] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5136c7d..ec313e3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +SWIFT 5 compatible + ### How to Add Sticky Section Headers to a Collection View #### Author: Bart Jacobs