Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Swift 4.2 support #15

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 5 additions & 5 deletions Source/HFCardCollectionViewLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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!)
}
}
}
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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
Expand Down