Answers for "Error with preview @FocusState SwiftUI"

0

Error with preview @FocusState SwiftUI

// The workaround I found here is to wrap the preview in a ZStack, like so:
// @anarchymedes
@MainActor
struct TripInfoView_Previews: PreviewProvider {
    @StateObject static var currenttrip: TripStore = TripStore.instance
    static var previews: some View {
        ZStack {
            TripInfoView(currenttrip: currenttrip, tripPartIndex: .constant(0), signalclosure: nil, readOnlyMode: .constant(false)).environmentObject(currenttrip)
        }
    }
}
Posted by: Guest on March-08-2022
0

Error with preview @FocusState SwiftUI

@MainActor
struct TripInfoView_Previews: PreviewProvider {
    @StateObject static var currenttrip: TripStore = TripStore.instance
    static var previews: some View {
        ZStack {
            TripInfoView(currenttrip: currenttrip, tripPartIndex: .constant(0), signalclosure: nil, readOnlyMode: .constant(false)).environmentObject(currenttrip)
        }
    }
}
Posted by: Guest on March-08-2022

Code answers related to "Error with preview @FocusState SwiftUI"

Code answers related to "Swift"

Browse Popular Code Answers by Language