View Encapsulation Architecture
Tinder Firestore Swipe and Match
Often you'll find your View Controllers very heavy and bloated with unnecessary view code. One easy remedy to this common problem is to create a simple view subclass that holds all of your subviews. This will make it much easier to maintain and read later down the road.

Comments (19)
Kevin Jefferson
4 years ago
Where did you download the buttons from or were they self made?
Brian Voong
4 years ago
Kevin Jefferson
4 years ago
hahahahaha
Ally Makongo
4 years ago
:) hehe
ravikanth.marri@gmail.com
4 years ago
Wow , Amazing !
Christopher J. Roura
4 years ago
The commented line // Mark:- Fileprivate doesn’t create a separating line for me. Am I missing something else maybe?
Brian Voong
4 years ago
Christopher J. Roura
4 years ago
Perfect that did the trick. Thank you for the very speedy reply. Also, I’m just curious to know if you can create some more videos with those circle animations. I really enjoyed those videos and would like to know what more I can possibly do with them. Thanks again!!
Brian Voong
4 years ago
Christopher J. Roura
4 years ago
I was looking to try two things. One, to take the initial circle with the pulse animation and move it and two, to combine CAAnimation with cgpath to make customized logos for a splash screen of sorts. For the pulsing circle when I move it in the top right corner for instance the pulse will not be even around the circle but instead move towards the top right corner. It’s a constraint issue for sure I think but just can’t figure it out. Also, I’m sorry for the many questions but I am curious to know what is the best way to work on a team that uses storyboard? I have gotten used to doing this programmatically as it just makes more sense to me but find it challenging when others I work with use a storyboard. Have any ideas?
Brian Voong
4 years ago
Christopher J. Roura
4 years ago
hi I have another hopefully quick question. I recently found out that for certain devices you can customize a stack view to appear horizontally in landscape but vertical in portrait. If you have a picture for instance in normal portrait orientation the picture will be on top and text will be connected underneath in a stack view. Then in landscape to avoid shrinking the image you can change the axis (I believe it is called) to be compact, regular to then put the picture on the left hand side and the text on the right hand side instead of top and bottom to take better care of the sizes of the picture and text and to better use the orientation layout given. How can I do this programmatically. In storyboard I would be adding a new axis for the stack view when in landscape but I’m not sure how to go about coding that. Thanks again for the help and support!
Brian Voong
4 years ago
Christopher J. Roura
4 years ago
You have been the best with helping. Thank you lots!!
rforbes1004
4 years ago
I couldn't agree with this more! Thanks so much for making these tutorials you're a lifesaver!
richardbranson
4 years ago
Another great lesson!
dh85
4 years ago
Great video. I have found myself using UIStackView more and more. It makes setting up a UI a lot quicker. I have them useful for the iPad as well when working with split screen and trait collections, makes it a breeze to adapt the view. Any chance of more universal apps that adapt for iPhone and iPad? Just a note. You don't have to use img.withRenderingMode(.alwaysOriginal) if you set the UIButton(type: .custom), instead of .system. Custom type will also have highlighted states. Also, have you considered using an autolayout library like SnapKit?
Brian Voong
4 years ago
kralmurti
4 years ago
s
Brian Voong
4 years ago
kralmurti
4 years ago
hi brian, sorry for my first comment. I couldn't edit it. When I click somewhere outside of the button image, it detects the button in stack view. can you help?
Brian Voong
4 years ago
Tokyojogo
4 years ago
Hi Brian, When you say manually layout the buttons, do you mean add a view in the stackview then insert the buttons in each view? Can you show a sample? Thanks.
Brian Voong
4 years ago
Cinquain
4 years ago
That episode was smooth!
stonypig1
4 years ago
thanks for this great tutorial, I like to go too some public places to watch them like library or Starbucks,their internet sucks. is there anyway in the future that you can make an iOS app for your course content? so we can cache the content offline and watch it, but not downloading. thanks
vialli45
4 years ago
Hey Brian thanks for the awesome course! I see that now you have icons under the project, however their files names are still strange, like "4d860822-2a26-42ed-91f0-9a971494ffdd.png", which still needs to be renamed manually. What I've been doing before this, is downloading the project, then going into "Assets.xcassets" folder and picking them one by one into my "Assets.xcassets" folder. Since you're providing the assets from now on, can you instead just zip those images and attach the url for zip with images? That will allow us to drag and drop the files. Thanks again!
frankcrest
4 years ago
Hi Brian, how come layoutMargins = .init(top: 0, left: 16, bottom: 0, right: 16) doesn't give me spacing for the topnavigationstackview?
Brian Voong
4 years ago
frankcrest
4 years ago
i figured it out after the next lesson, have to set this property isLayoutMarginsRelativeArrangement = true
rphuber
4 years ago
what do the extra UIViews in the array for the top stack view give you? Seems that if I leave them out and use the .equalCentering distribution I end up with the same layout? Thanks for the great course!
Kārlis Bērziņš
4 years ago
I was also about to ask the same question. Why do we need those "spacing UIViews" if we can use .equalSpacing distribution? What's the advantage of using those UIViews?
stayclar
4 years ago
Would be nice to know Brian, is there any purpose of this?
Brian Voong
4 years ago
HungryStag
4 years ago
FYI - In Xcode 10 image literals autocompletion is no longer available. You can still access image literals by "Shift + CMD + M" and then dragging and dropping your image into the code.
Kevin Peng
4 years ago
Thank you, this is a life saver!
yshelatkar
4 years ago
Hey Brian my image buttons are looking way bigger https://drive.google.com/file/d/0B_lOd3-e2JkMLXNFMEpLR0RqT2I1cGlLZTZZdXp5a1lYWnU0/view?usp=sharing
yshelatkar
4 years ago
Here's the correct Link: https://drive.google.com/file/d/156BdofQv-SL03iBtznoKra7KxjdWP7yg/view?usp=sharing
Brian Voong
4 years ago
Dominic Bryan
4 years ago
Someone else may have had this issue, if you add the image assets and set a single scale/universal scale, you may see your button images stretched strangely. This can be solved by setting the button's image view content mode to scale aspect fit inside if the map function. button.imageView?.contentMode = .scaleAspectFit
scholarDev
4 years ago
Why don't we just set the distribution to fillEqually in Top Navigation Stack View rather then adding UIViews???
Brian Voong
4 years ago
David Guarino
3 years ago
Hey Brian I am doing the course again this time with Xcode 11 and had a heck of time with [imageLiterals] @ 12:28, couldn't access them either with SHIFT+CMD+M.....Ended up just copying and pasting from my other file....Don't know if it was my error or an update that your users won't be able to complete in this lesson. Just curious what your solution is
zach.spoor
3 years ago
David, I also had the same issue. It seems that Xcode 11 now uses something like <code>#imageLiteral(resourceName: "top_left_profile")</code> in place of Image Literal. Though, every now and then an actual "Image Literal" option did appear when typing it out. Think it is def buggy as Brian mentioned.
aymather
3 years ago
Man I got really excited to see that you were gunna need to resize that image because I've had a lot of problems with sizing images, and instead you just used a hack :( Do you have any videos that teach how to work with image assets and sizing? Great course overall though, really appreciate it!
Akbar Muhtar
3 years ago
Do you recommend use storyboard for this stackview design? Seems it would be much easier using storyboard?
Brian Voong
3 years ago
Mehmet Cemal Öztürk
2 years ago
mmn
HELP & SUPPORT