From the course: Complete Guide to SwiftUI
Unlock this course with a free trial
Join today to access over 24,600 courses taught by industry experts.
Extensions
- [Instructor] It's time to start customizing SwiftUI. Critical to customization's extensions, code that adds methods or computed properties to an existing structure or class. Often these objects you cannot normally modify, for example, SwiftUI's color. While assets are nice as we've seen, they could still be a bit of extra typing. For custom colors like sky, I'd like to be able to type .sky when I need a color, instead of color quote sky. A few lines of code is also a lot more portable than asset colors. So, let's make an extension to turn our custom colors into an extension. Okay, so I'm going to close up the Preview, and I'm going to start making some new files here. So, I'm going to go over here. I'm just going to make sure I'm in the right place. I'm just going to hit HuliPizzaApp and then do a Command N. We're going to be making a Swift File instead of SwiftUI View this time and hit Next. And we're going to call this StyleSheet, and go ahead and hit Create. And we're going to be…
Contents
-
-
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Extensions5m 14s
-
(Locked)
Custom modifiers3m 53s
-
(Locked)
More modifiers2m 33s
-
(Locked)
Modifiers with parameters5m 13s
-
(Locked)
Shapes6m 11s
-
(Locked)
Modifiers with added views5m 19s
-
(Locked)
ViewBuilder3m
-
(Locked)
Conditional ViewBuilder3m 40s
-
(Locked)
Challenge: Make Home a back button29s
-
(Locked)
Solution: Make Home a back button5m 36s
-
(Locked)
-
-
-
-