TL;DR Swipe Right, Swipe Left - That's it. Have a hackthon idea? Fork this and build something cool!
This project was inspired by a few hackathon designs I've seen this year while mentoring for Cal Hacks. This swipeable UI is a popular design pattern to accept/reject a list of items.
- Swipe Right - accept
- Swipe Left - reject
- ✅ Fork the Project
- ✅ Build + Run
- ✅ Swipe!
class SwipeSelectorViewController: UIViewController, SwipeSelectorDelegate {
var swipeSelectorView = SwipeSelectorView()
override func viewDidLoad() {
super.viewDidLoad()
swipeSelectorView = SwipeSelectorView(delegate: self)
self.view.addSubview(swipeSelectorView)
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
swipeSelectorView.frame = self.view.frame
}
// MARK: SwipeSelectorDelegate
func swipeSelectorViewNumberOfItems(_ swipeSelectorView: SwipeSelectorView) -> Int {
// DataSource ...
}
func swipeSelectorViewItemForOverflow(_ swipeSelectorView: SwipeSelectorView) -> SwipeSelectorModel {
// DataSource ...
}
func swipeSelectorView(_ swipeSelectorView: SwipeSelectorView, itemForRowAtIndex: Int) -> SwipeSelectorModel {
// Configure Cards ...
}
func swipeSelectorViewDidSwipe(_ swipeSelectorView: SwipeSelectorView, itemAtIndex: Int, isRightSwipe: Bool) {
// Handle Swipes ...
}
func swipeSelectorViewDidTap(_ swipeSelectorView: SwipeSelectorView, itemAtIndex: Int) {
// Handle Tapping Specific Cards
}
}
- Dependency Management using Swift Package Manager, Carthage, or CocoaPods
- Add Generic UIView Handling - Cards need to be more flexible for developers to input custom views.
- Add Documentation - for publc classes/methods. See Swift Documentation
- Xcode 12.0+
- Alex Takahashi - Initial work - alextakahashi
I am not a lawyer, but no guarantees if this breaks, totally not responsible if things go to shit - don't sue me, kthx. Add MIT License.