Suppose you have a view:
struct Library: View {
@State var books = []
var body: some View {
VStack {
...
Button("add Book") {
....
}
}
}
Such that Library
view holds a Book
array that gets populated internally via a button that opens a modal – or something alike.
How can I use #Peview
s to preview Library
with a pre-populated collection? Suppose I have a static
books – dummy – array in my code just for that; still, what's the best way to use that to preview the Library
view?