diff --git a/InfiniteCollectionView.xcodeproj/project.pbxproj b/InfiniteCollectionView.xcodeproj/project.pbxproj index 51d0cda..4819e8a 100644 --- a/InfiniteCollectionView.xcodeproj/project.pbxproj +++ b/InfiniteCollectionView.xcodeproj/project.pbxproj @@ -89,12 +89,18 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 9999; + TargetAttributes = { + OBJ_17 = { + LastSwiftMigration = 1020; + }; + }; }; buildConfigurationList = OBJ_2 /* Build configuration list for PBXProject "InfiniteCollectionView" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = OBJ_5; @@ -135,6 +141,7 @@ PRODUCT_BUNDLE_IDENTIFIER = InfiniteCollectionView; PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SWIFT_VERSION = 5.0; TARGET_NAME = InfiniteCollectionView; }; name = Debug; @@ -155,6 +162,7 @@ PRODUCT_BUNDLE_IDENTIFIER = InfiniteCollectionView; PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SWIFT_VERSION = 5.0; TARGET_NAME = InfiniteCollectionView; }; name = Release; diff --git a/InfiniteCollectionView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/InfiniteCollectionView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/InfiniteCollectionView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Sources/InfiniteCollectionView.swift b/Sources/InfiniteCollectionView.swift index 5111dde..8ff2bcc 100644 --- a/Sources/InfiniteCollectionView.swift +++ b/Sources/InfiniteCollectionView.swift @@ -44,12 +44,12 @@ open class InfiniteCollectionView: UICollectionView { configure() } deinit { - NotificationCenter.default.removeObserver(self, name: .UIDeviceOrientationDidChange, object: nil) + NotificationCenter.default.removeObserver(self, name: UIDevice.orientationDidChangeNotification, object: nil) } - open func rotate(_ notification: Notification) { + @objc open func rotate(_ notification: Notification) { setContentOffset(CGPoint(x: CGFloat(pageIndex + indexOffset) * itemWidth, y: contentOffset.y), animated: false) } - open override func selectItem(at indexPath: IndexPath?, animated: Bool, scrollPosition: UICollectionViewScrollPosition) { + open override func selectItem(at indexPath: IndexPath?, animated: Bool, scrollPosition: UICollectionView.ScrollPosition) { guard let indexPath = indexPath else { return } // Correct the input IndexPath let correctedIndexPath = IndexPath(row: correctedIndex(indexPath.item + indexOffset), section: 0) @@ -84,7 +84,7 @@ private extension InfiniteCollectionView { delegate = self dataSource = self register(UICollectionViewCell.self, forCellWithReuseIdentifier: defaultIdentifier) - NotificationCenter.default.addObserver(self, selector: #selector(InfiniteCollectionView.rotate(_:)), name: .UIDeviceOrientationDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(InfiniteCollectionView.rotate(_:)), name: UIDevice.orientationDidChangeNotification, object: nil) } func centerIfNeeded(_ scrollView: UIScrollView) { let currentOffset = contentOffset