I get a Type 'Service_ValetApp' does not conform to protocol 'App' and I get a fix from the compiler: Do you want to add protocol stubs? Even though I have an init() already in the file. This looks like a bug to me. If anyone has seen this before I would appreciate any and all insights.
import SwiftUI
@main
struct Service_ValetApp: App {
@Binding var isInitializing: Bool
init(isInitializing: Binding<Bool>) {
self._isInitializing = isInitializing
}
var body: some Scene {
WindowGroup {
MotherView(isInitializing: self.$isInitializing).environmentObject(ViewRouter())
}
}
}
Type type
App
needs to have an initializer that takes zero arguments:You have a argument in your initializer:
The system is calling
init
and wouldn't know what to pass forisInitializing
.Secondly, you have a
@Binding
in yourApp
--@Binding
is used with child views, but this is the top-most parent app component.Perhaps you meant to use
@State
with a default value instead: