Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
We have all seen views in dating apps where we can just swipe left or right to accept or reject something. If you are bored with table views and collection views, you can use Swipe cards. The whole card swiping idea is now used in tons of apps. Let’s check how can we implement card swipe in swift.
Now, we are implementing Swipe cards in swift and it’s pretty easy to implement in swift. I have used a third party library named shuffle but it can be implement without using any library. I have used Shuffle library to implement it easily.
1. Create a new project & add shuffle pod in your pod file.
2. Now install the pod & import it into your view controller.
3. Create a view named swipeView in the storyboard.
4. Now create a card function taking an image as a parameter & returning SwipeCard.
Create left & right overlays and set them on card overlays. The card returned from card(fromImage:) displays an image, can be swiped left or right, and has overlay views for both directions.
card(fromImage:)
5. Add multiple images in the asset & create an array of card images.
6. Initialize your card data and place a SwipeCardStack on your view in viewdidload.
SwipeCardStack
7. Conform your class to SwipeCardStackDataSource and set your card stack’s dataSource.
SwipeCardStackDataSource
dataSource
This is how we swipe cards in swift. You can use more of its properties.
Thanks for reading this article ❤
If I got something wrong 🙈, let me know in the comments. I would love to improve.
For more interesting blogs check out here – https://mobikul.com/blog/
Reference link: https://swiftobc.com/repo/mac-gallagher-Shuffle-swift-cards
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Name
Email
Subject
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.