Posts

Showing posts with the label ternary

Ray Wenderlich Course - SwiftUI (Part 3)

Cracking on with SwiftUI! As I've said, this has been a tricky course but I'm learning plenty. Let's continue! Start Time - 19:55 Slider and Stepper Stepper - plus or minus a value (buttons for this) Slider - as with bullseye State - use of @State and the $ symbol. struct ContentView : View {          @ State private var orderCount = 0   var body : some View {     VStack {         Stepper (onIncrement: { self . orderCount += 1                      } , onDecrement: { }) {             Text ( "Set order amount" )         }     }   } } A bit about state - this is a value that can change and will update accordingly.  So this is a lot easier!   Stepper ( "Set order amount" , value: $orderCount) Slider (value: $houseTemperature , in: ( 30 ... 1...

Bob Lee Course Part 8 (lectures 12 to 15)

Image
Next day, next lecture! I literally have 25 minutes now so I will see if I get to a natural end point... Extensions Now I know about these already. Extensions are a way of adding more code to different types. E.g. to Int, I could add a function or something that gives more usability. I can also extend custom types e.g. structs and classes. *Udemy course not loading properly. Going to have to delay start time for now.  Start Time - 15:39  *I only have around 15 minutes for now so will have to continue the entry for later. OK, so the issue here is that you CANNOT have STORED properties in extensions. Right, so in this case, the description property is computed. So this is a cool example of using a new property (computed!) for Int. Squared! So that is everything we can do with extensions. Most of these are later as you can see. So far, that's good. I had to race through some of the using init...