I have these @AppStorage settings and the related code to bind them and it works fine:
@AppStorage("settingsToken") private var settingsToken: String = ""
@AppStorage("settingsUser") private var settingsUser: String = ""
@AppStorage("settingsSlug") private var settingsSlug: String = ""
...
...
Text("Token")
.font(.system(size: 17, weight: .regular, design: .rounded))
.foregroundColor(settingsAccentColor)
TextField("Saved Token", text: $settingsToken)
Text("User")
.font(.system(size: 17, weight: .regular, design: .rounded))
.foregroundColor(settingsAccentColor)
TextField("Saved User", text: $settingsUser)
Text("Slug")
.font(.system(size: 17, weight: .regular, design: .rounded))
.foregroundColor(settingsAccentColor)
TextField("Saved Slug", text: $settingsSlug)
But if I add a new @AppStorage...
@AppStorage("settingsLogo") private var settingsLogo: String = ""
...
...
Text("Welcome logo")
.font(.system(size: 17, weight: .regular, design: .rounded))
.foregroundColor(settingsAccentColor)
TextField("Logo", text: $settingsLogo)
I get a compile error: Trailing closure passed to parameter of type 'FormStyleConfiguration' that does not accept a closure, on the form of the NavigationView
var body: some View {
NavigationView {
Form {
Removing the following line prevents the compile error but clealy I need this:
TextField("Logo", text: $settingsLogo)
I really can't see what difference adding this new @AppStorage which is exactly the same as the other does.
Note that settingsLogo will be a URL of an image, so i'm using a String.