Flashcards App: Drag a UIView with label within other UIView

Hello everyone!

I am trying to figure out how to do this for my flashcard app:

We want to drag a uiview that has a label inside it which height is not fixed depending on content. We want to drag that uiview within some other uiview not out of frame of parent uiview.

Please see video here: https://drive.google.com/file/d/1rinsCRy4QonbNVaJgdA2qX3dKLJTiPd4/view?usp=sharing

How is this being done in the app? Is it possible to do this with the tinder swipe feature where card gets put left, up, right?

Thanks!!

Paul Hudson created a Flashcards App in SwiftUI as one of the projects to build in his free 100 Days of SwiftUI Course. It might be worth having a look at that. The Flashcard App build starts around Day 86.

Thanks Chris! Any suggestions for doing this in just regular Swift, not SwiftUI?

In UIKit the Gesture you need to deal with is the Pan gesture. See this description from the Apple documentation.

https://developer.apple.com/documentation/uikit/touches_presses_and_gestures/handling_uikit_gestures/handling_pan_gestures

Thanks Chris! I am curious if there’s any reference code to see some examples, any ideas?!

I’m confused because like in this video there is a new view that pops down when tapped and then the entire card is draggable. Is it possible to have this same feature but also have tinder swipe left up or right?

https://drive.google.com/file/d/1rinsCRy4QonbNVaJgdA2qX3dKLJTiPd4/view?usp=sharing

Or only like it video? I’m curious how it’s done in the video!
Thank you!! Still learning this as this movement and dragging is new to me!!

@toothdoc

Sorry man, no idea if there is any sample code to get you started.

Thanks Chris! I may just need to do it in SwiftUI! I wonder if anyone else reading this has any suggestions?!