diff --git a/README.md b/README.md index 88352f9..9534271 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # HFCardCollectionViewLayout The HFCardCollectionViewLayout provides a card stack layout not quite similar like the apps Reminder and Wallet. +## Requirements +- Swift 4.2 + Features: - Many options, also within the InterfaceBuilder diff --git a/Source/HFCardCollectionViewLayout.swift b/Source/HFCardCollectionViewLayout.swift index 593c43a..793e757 100644 --- a/Source/HFCardCollectionViewLayout.swift +++ b/Source/HFCardCollectionViewLayout.swift @@ -540,8 +540,8 @@ open class HFCardCollectionViewLayout: UICollectionViewLayout, UIGestureRecogniz private func initializeCardCollectionViewLayout() { self.collectionViewIsInitialized = true - NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillShow(_:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidHide(_:)), name: NSNotification.Name.UIKeyboardDidHide, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillShow(_:)), name: UIResponder.keyboardWillShowNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidHide(_:)), name: UIResponder.keyboardDidHideNotification, object: nil) self.collectionViewTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.collectionViewTapGestureHandler)) self.collectionViewTapGestureRecognizer?.delegate = self @@ -1015,7 +1015,7 @@ open class HFCardCollectionViewLayout: UICollectionViewLayout, UIGestureRecogniz self.collectionView?.insertSubview(self.movingCardSnapshotCell!, belowSubview: belowCell) self.movingCardSnapshotCell?.layer.zPosition = belowCell.layer.zPosition } else { - self.collectionView?.sendSubview(toBack: self.movingCardSnapshotCell!) + self.collectionView?.sendSubviewToBack(self.movingCardSnapshotCell!) } } } @@ -1078,7 +1078,7 @@ open class HFCardCollectionViewLayout: UICollectionViewLayout, UIGestureRecogniz self.invalidateScrollTimer() self.autoscrollDisplayLink = CADisplayLink(target: self, selector: #selector(self.autoscrollHandler(displayLink:))) self.autoscrollDirection = direction - self.autoscrollDisplayLink?.add(to: .main, forMode: .commonModes) + self.autoscrollDisplayLink?.add(to: .main, forMode: .common) } private func invalidateScrollTimer() { @@ -1159,7 +1159,7 @@ open class HFCardCollectionViewLayout: UICollectionViewLayout, UIGestureRecogniz if(gestureRecognizer == self.revealedCardPanGestureRecognizer) { let velocity = self.revealedCardPanGestureRecognizer?.velocity(in: self.revealedCardPanGestureRecognizer?.view) - let result = fabs(velocity!.y) > fabs(velocity!.x) + let result = abs(velocity!.y) > abs(velocity!.x) return result } return true