Check Mobile App
Read now
Start a Project

Swipe Cards in swift.

Save

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.

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.

7. Conform your class to SwipeCardStackDataSource and set your card stack’s dataSource.

Full code:

Output:

Conclusion:

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

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php

Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.

Osama
Talk to Sales

Global

Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home