today I'm wondering if it's possible to work designing a view on SwiftUI using PreviewProvider It's difficult when you have models because you need to "Initialize" every Model and Attribute to see the UI Emulator. Ex
struct SimpleView: View {
@State private var number : Int
var body: some View {
ScrollView{
VStack{
Text(String(number))
}
}
}
}
struct SimpleView_Previews: PreviewProvider {
static var previews: some View {
SimpleView(Int: 5)
}
}
UI Preview Works good!
But what if I need to use a custom object with 40-70 properties... :(
Is there a way to work without "hardcode" in the beginning?
Thank you so much
MockViewModelsubclass of the relevantViewModelor if the view model is a struct I create a static function on te struct that returns an appropriate "mock" instance of the struct.