User Details Swiping Photos
Tinder Firestore Swipe and Match
Let's move on in today's lesson and implement our SwipingPhotosController into our UserDetailsController page. We'll first start by replacing our imageView at the top with the view that belongs on our swiping controller. Next we'll pipe in our card view model object that will help us generate the controllers that we swipe through. Enjoy.

Comments (11)
jiarongkoh
4 years ago
Hi Brian, on first thought I would approach the swiping photos part with a collectionView. Care to share why would you choose to approach it using pageViewController instead of a collectionView? Any pros and cons for pageViewController over collectionView?
Brian Voong
4 years ago
Christophe Bugnon
4 years ago
I've seen all your courses and I love to get different ways to create the same thing. It creates more flexibility and creativity for all next features I'll have to creates. :)
mashype
4 years ago
Same! I loved the approach because it shows more functionality and new solutions.
sjs870501
4 years ago
Hi Brian:) I found a little bug which is that when I change the images'(default images like flower, waterfall) content mode to scaleAspectFill, the images' width get wider than view.frame.width. So when I get to the page before, I have two images together. I though I could have a problem with my coding so I copied you swift file and tried, but the bug was still there.
Brian Voong
4 years ago
sjs870501
4 years ago
oh man.. now I know what clipsToBounds means.. thank you so much! a lot to learn:)
slcott
4 years ago
I am following your tutorials closely by retyping, but I have a bug in my solution. Everything has worked fine up until this lesson. When first tapping info button and entering `UserDetailsController`, the swiping image shows up larger than dimension of screen. If I scroll once then it resizes immediately to appropriate size. However, if I put these two lines: ```let swipingView = swipingPhotosController.view! swipingView.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.width + extraSwipingHeight)``` inside of `viewDidLayoutSubviews()` the bug is gone. Do you know what might be causing my problem? I downloaded your project and searched but did not find the difference.
Brian Voong
4 years ago
slcott
4 years ago
Wait... What? I downloaded the project about an hour ago and you definitely used: `viewWillLayoutSubviews()` in the code & video. Like I said, I had to use: `viewDidLayoutSubviews()`. ...maybe I didn't catch the bug occurring in the video.
Brian Voong
4 years ago
slcott
4 years ago
I triple checked and I cannot find a logical difference. https://*****/TinderCourseLBTA.zip Do you see the error? Hopefully, this resolves a problem that others might be encountering.
Brian Voong
4 years ago
Brian Voong
4 years ago
slcott
4 years ago
Thanks for helping me! I was about to go line by line, but you fixed it before I had an opportunity. After seeing the fix, first thought is that I was overeager in refactoring my code. And second, reflecting on the combo of UIScrollView, scales, constraints is that this is unpredictable stuff. In the future I think I'm just gonna steer clear of using UIScrollView.
Tube
4 years ago
For the previous few lessons, I was POSITIVE you would be using a child view controller here!
Cinquain
4 years ago
That video was fire!
Binh Huynh
4 years ago
Hi Brian, If you use images that are captured in landscape mode, i.e the width is bigger than the height, along with portrait mode photos, you will see part of the landscape photo overlap portrait photo when you swipe I was trying to set frame of the imageView in PhotoController by this line of code, but no luck ! imageView.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.width) Can you take a look how to fix this ? Thanks
Binh Huynh
4 years ago
Nevermind, I found out that I miss the clipsToBounds = true :)
rehannali
4 years ago
Hi Brain! There is a quick question. Why you always optional binding for image URLs while sd web image accepts optional URL and handle everything?
Brian Voong
4 years ago
Cinquain
4 years ago
Good stuff
Jeeeun Lim
4 years ago
player doesnt work... help me out here
Brian Voong
4 years ago
georrgee
4 years ago
Hey Brian! After going through this video, I've countered a small bug in the UserDetailsController. So this user has 3 photos and we'll call this "image1", "image2", "image3". setViewControllers([controllers.first!], direction: .forward, animated: false) does the page swiping. However, when in the home controller, image1 is first photo of this user's profile. When clicking more details about the user, image1 becomes the last photo of the list. So I have to swipe left and it is completely backwards. What do you think is the issue?
David Guarino
4 years ago
Check your 2 functions in SwipeController: Be sure "after" and "before" has the correct logic in it...you may need to switch them....Hope this helps
georrgee
4 years ago
Ah that makes sense... Got it to work properly now! Thanks David!
mrchanlee
3 years ago
Hi Brian, I have a question about creating multiple constant of swipingView. Is it considered bad practice to create multiple constant that are exactly the same?
Brian Voong
3 years ago
HELP & SUPPORT