Swift: Watch Out for Safe Areas, UIStackViews Rock! (Ep 3)

preview_player
Показать описание
Safe Areas inside the iPhone X are meant to help you layout your views correctly so they don't fall underneath the notch areas of your screen. Today we discuss the technique of anchoring on our UIViewController's safe areas using layout guides. In addition, I'll go over how to use a UIStackView to make our lives a lot easier in terms of adding in buttons at the bottom. Have fun.

Instagram Firebase Course

Facebook Group

iOS Basic Training Course

Completed Source Code

Рекомендации по теме
Комментарии
Автор

Such a great guy! Not only I understand what he teaches, but also guess what he thinks. That's not because i'm a genius or something. He's done it in a very clear and understandable way that it even feels like an interactive class.

abelmengesha
Автор

Thank you. It's rare to find Swift tutorials that explains things well, gives appropriate callouts, moves at the right pace, and actually has nice UI. Well done. I'm definitely subscribing now!

atheros
Автор

StackViews! Where have you been all my life! :)

narco
Автор

you are the best in the world at teaching this.

neil
Автор

One of the best example to show the use of extensiosns 🍻.

sandeepbansal
Автор

Your videos are awesome! They've already helped me a lot. Thanks for that :)

JayH
Автор

Great video looking forward next video. have a nice day!

Gabrielism
Автор

This is an awesome series! Thanks Brian

landahoy
Автор

Keep doing what u do! You are doing a great job dude

LegendarySkyHero
Автор

Thanks BRIAN for the awesome work! Just a trick, you can define colors en the Asset like images.

abdouett
Автор

Thanks for the free videos. Great learning material.


Just a personal note:
When I follow this videos I'm playing with other controls to see what happens to the UI (eg.: background color, font, etc.)
it would have been better to call the setupBottomControls after setupLayout(), in my case I put a background color on the top container and was not able to see the button.

cloudplayro
Автор

If you want to use auto layout constraints without the headache I recommend using SnapKit. Thank me later.

zackperdue
Автор

Thanks Brian. A suggestion for encapsulation and the marking of private methods, types: use a leading underscore for all private elements, to clearly mark them out as private. This helps you instantly recognise what belongs to the class/struct, and what doesn't.

e.g.

var somePublicProperty: Int = 0
fileprivate let _kSomePrivateConstant: CGFloat = 3.14
fileprivate var _somePrivateView: UIView!
fileprivate func _somePrivateFunction() { ... }

wmblemania
Автор

Amazing content Brian thank you.

off topic: are you using photoshop to put together these youtube video thumbnails? I think they look very good.

cruy
Автор

A tip: for backward compatibility, we use the (now deprecated) top and bottom layout guides in iOS 10 and earlier:

if #available(iOS 11, *) {
// ... Create constraints using view.safeAreaLayoutGuide.
} else {
// ... Create constraints using viewController.topLayoutGuide, view.bottomLayoutGuide
}

(Note that safeAreaLayoutGuide is a property on UIView, whereas the topLayoutGuide and bottomLayoutGuides are properties on UIViewController)

wmblemania
Автор

Great stuff.
What if I want the page control to be much wider than previous and next buttons. Can it be done by UIStackView easily?

superwsuperw
Автор

Brian. Is this correct elaboration about fileprivate as mentioned below

fileprivate is one of the new Swift 3 access modifiers that replaces private in its meaning. fileprivate defines an entity (class, extension, property, ...) as private to everybody outside the source file it is declared in, but accessible to all entities in that source file.

private restricts the entity in the direct enclosing scope.

WikkiOnIlluminati
Автор

can you make video on parsing data from any web api from scratch? So it can help to understand web request handling.

prachitpatil
Автор

Brian

Is that pink color you made in extension is Initializers kind of extension?

WikkiOnIlluminati
Автор

Brian, would you recommend the official Apple Swift books?

anonymouse