Bonus Lesson - Size Class Landscape Layout
Tinder Firestore Swipe and Match
A bonus lesson for today's video related to landscape orientation layout for our Registration Page. As you all know, handling landscape for certain situations is a must and providing a different layout for your UI helps a lot. This lesson will cover how to utilize the axis of a UIStackView component to rearrange elements on the screen. We'll also be inspecting our view controller's trailCollection properties and its verticalSizeClass to toggle the axis properties. Enjoy.

Comments (12)
Shahrukh Mohammad
4 years ago
Yes, we would like to see that code for scrollview, please
Shahrukh Mohammad
4 years ago
To be fair, I have been achieving the desired effect by using a table view cell or collectionview cell instead. But is scrollView approach better or more professionally used?
Brian Voong
4 years ago
ayon
4 years ago
but working with the scrollView is really a pain.I think collectionView is mich better to work on.What is your take on that Brian?
LionCode
4 years ago
me too
st4n
4 years ago
LOL, animoji breaks the comment section :) anyways: thanks Man! :) that was much easier than I thought it'll be :) although my console starts spitting autolayout errors on me: 1 .constant height for our cusotm TF's in landscape 2. and forced constant 275 width for selectPhotoButton in vertical I'll try to move some code to this traitCollection func :) Maybe, somewhere in this course you can find the opportunity to cover the topics of Content Hugging Priority and Content Compression Resistance Priority.
benpalmer661
4 years ago
Hey Brian I am trying to append users from firestore onto cards but am having trouble not sure if i am heading in the right direction or not? trying to append user from firstore to the variable cardUsers. then maybe setting producers = cardusers , but i hitting errors/deadends var cardUsers = [UserGrapevine]() as [ProducesCardViewModel] let cardViewModels: [CardViewModel] = { let producers = [ UserTinder(name: "Kelly", age: 23, profession: "Music DJ", imageNames: ["lady5c","lady4c","kelly1","kelly2","kelly3"]), UserTinder(name: "Jane", age: 18, profession: "Teacher", imageNames: ["jane1","jane2","jane3"])] as [ProducesCardViewModel] let viewModels = producers.map({return $0.toCardViewModel()}) return viewModels }() func fetchUsersCurrentUserIsFollowing(){ guard let uid = Auth.auth().currentUser?.uid else { return } let db = Firestore.firestore() db.collection("Users").document(uid).collection("Following").getDocuments() { (querySnapshot, err) in if let err = err { print("Error getting documents: \(err)") } else { for document in querySnapshot!.documents { //print("\(document.documentID) => \(document.data())") let d = document.data() d.forEach({ (key: String, value: Any) in print("this is the key",key) Database.firestorefetchUserForGrapevineCardWithUID(uid: key, completion: { (user) in //bpxxx self.cardUsers.append(user) } )} )} } } } ///////////////////////////////////////////////////////////////////////////// //the func Database.firestorefetchUserForGrapevineCardWithUID(uid: key, completion: { (user) //pretty much gives me a user as seen below let user = UserGrapevine(name: displayName, age: age, profession: occupation, imageNames: ["lady5c"], kmsAway: distanceInKms) completion(user) /////////////////////////////////////////////////////////////////////////////
Brian Voong
4 years ago
dhekstro
4 years ago
So tell me, do you plan to stick to your previous promises regarding the courses you intend to release in this platform? Namely, Backend Server, Uber-Like App, Instagram for Android, etc.? Because most of us are really eager to become gradually more independents, aiming to full stack developer status, most of us are one-man developer teams who have to embody all the roles in a App Development Life-Cycle. Another issue I've been waiting to see clarified is the fact that ever since you did the revamping of the site, we lost our previous data like questions posted, etc. and you never took some time to explain to us what happened or if it would ever be restored some time in the future!! Hope you take a few minutes to address this concerns. Thanks and regards.
Brian Voong
4 years ago
dhekstro
4 years ago
Hey Brian, thanks a lot for taking out a bit of your precious time to clarify those stuffs. I'm impressed by your pace, you're really on fire and relentless, you put the Twitter Slide-Out Menu and short after you started the Tinder with an incredible pace as well. I can't be thankful enough for the world-class material you've been putting out, hands-down, pal! Keep up the great work, humanity thanks you! ;-)
Yoel Lev
4 years ago
Hi Brian, Will be definitely interested to see how you implement it with the scrollView if you have some time, regarding the eCommerce app that is built on top Swift Vapor sounds like a winner, even though the Uber-Like App sounds even more interesting, yet again, thank you for the great quality content you provide, hope you continue delivering more intermediate++ courses. You Rock (:
Tube
4 years ago
FYI I didn't have the rotated partial background problem addressed at the beginning of the video.
ark
4 years ago
@Brian Voong Interested in seeing the right way to manage keyboard using UIScrollView
Brian Voong
4 years ago
ark
4 years ago
Thank you Brian I will look into that.
Cinquain
4 years ago
That video was fire!
rehannali
4 years ago
Hi Brain! There is a quick question regarding size classes. What if I want a different view which is not managed by stack view or not handled as easily as in stack views. So in that case, Are we need to layout view differently i.e. remake constraint or 2 separate views?
Brian Voong
4 years ago
mashype
4 years ago
I don't think I saw this in the comments, but is anyone else getting a duplicate constraint error at this point? I think it has something to do with the fixed height of the selectPhotoButton being 275 pixels while at the same time trying to sit in the overallStackView. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "<NSLayoutConstraint:0x6000012e6120 UIButton:0x7fe1efe14a20'Select Photo'.height == 275 (active)>", "<NSLayoutConstraint:0x6000012f07d0 '_UITemporaryLayoutHeight' UIButton:0x7fe1efe14a20'Select Photo'.height == 0 (active)>" Did anyone else get the same issue?
yongzhan
3 years ago
I have the same issue ....but i don't know how to resloved...
majdjamaleddine@gmail.com
3 years ago
Hey Brian, can you please clarify why you set the values (false/true) for width and height anchor of selectPhotoButton under traitCollectiondidChange whereas we could have hard corded their values when declaring selectPhotoButton, I noticed it had the same outcome so I wanted to know the benefit for that. Thanks again for the course.
Kevin Liu
3 years ago
Hey Brian, why are you using view.bounds and not view.frame when setting the gradientLayer's frame? I understand the frame is the coordinate system relative to its superview whereas the bounds is the coordinate system relative to itself. Isn't view.frame what we want here? I tried both view.frame and view.bounds and they had the same result. I think I'm not understanding something correctly here.
HELP & SUPPORT