Get SwiftUI previews working with debug data

This commit is contained in:
Angelo Stavrow 2020-08-25 11:40:30 -04:00
parent 21e8a4ca35
commit c14a03a332
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
3 changed files with 12 additions and 4 deletions

View File

@ -18,7 +18,9 @@ struct ContentView: View {
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.environmentObject(WriteFreelyModel())
let model = WriteFreelyModel()
model.collections = CollectionListModel(with: [userCollection1, userCollection2, userCollection3])
return ContentView()
.environmentObject(model)
}
}

View File

@ -8,6 +8,9 @@ struct SidebarView: View {
struct SidebarView_Previews: PreviewProvider {
static var previews: some View {
SidebarView()
let model = WriteFreelyModel()
model.collections = CollectionListModel(with: [userCollection1, userCollection2, userCollection3])
return SidebarView()
.environmentObject(model)
}
}

View File

@ -20,6 +20,9 @@ struct CollectionListView: View {
struct CollectionSidebar_Previews: PreviewProvider {
static var previews: some View {
CollectionListView()
let model = WriteFreelyModel()
model.collections = CollectionListModel(with: [userCollection1, userCollection2, userCollection3])
return CollectionListView()
.environmentObject(model)
}
}