Skip to content

Latest commit

 

History

History
82 lines (54 loc) · 2.64 KB

README.md

File metadata and controls

82 lines (54 loc) · 2.64 KB

👉 SwipeSelectorKit - Hackathon Starter Project

Swipe Selector Kit Demo

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.

Interactions

  • Swipe Right - accept
  • Swipe Left - reject

Getting Started

  1. ✅ Fork the Project
  2. ✅ Build + Run
  3. ✅ Swipe!

Try it Yourself

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
    }
}

Help Improve This Project!

Prerequisites

  • Xcode 12.0+

Authors

Acknowledgments

Liability

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.