April 2020
Beginner
316 pages
8h 20m
English
Following on from where we've just left off with UIKit and UITableViews in SwiftUI, we'll use @State in order to invalidate our current layout and force a reload. As a basic implementation, this will work really well and almost do our job for us.
Looking back at our previous example, if we have a mutable variable with our mockData, we could simply reassign some data and this would invalidate our layout and reload it with our new data:
@State var mockData = ["Recipe 1", "Recipe 2", "Recipe 3"]
This would be followed by something like this:
mockData = ["Recipe 4", "Recipe 5", "Recipe 6"]
This works a treat! Here, we're assigning basic types such as String, Int, Bool, Array, and so on. However, our data could ...
Read now
Unlock full access