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.
Conditional ViewBuilder
From the course: Complete Guide to SwiftUI
Conditional ViewBuilder
- [Instructor] We've seen the ability to simplify code with view builders. However, we can take view builders even further when you have some logic involved. So let's head over to order row view for this one. I'm going to close stuff up. I'm going to add three more view builders to this. I'll do one with some modifiers first for the extended price. So let's go ahead into here and just under binding, I'll start doing these. We'll start with a view builder and then a var. We'll call it extended price, be some view. We're going to use the order extended price we have down here. So I'm just going to copy this, pop it up here. Nothing new there, I'm going to do the same thing. I'm going to call one pizza name view. That's going to be some view. And this one, we're going to start with the text order item name. So we have that already here, so I'm just going to copy that. And I could have done the spacer as well. But here we're going to add one extra piece here. I'm going to put a…
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)
-
-
-
-