I'm new to Swift development and I'm having trouble trying to save a class to @AppStorage. If I have the following simple class:
class TestClass : Codable {
var testBool: Bool = true
}
And in the view:
struct ContentView: View {
var testClass1: TestClass = TestClass()
@AppStorage("testClass2") var testClass2: TestClass = TestClass()
}
The first var compiles fine but the @AppStorage var gives the error "No exact matches in call to initializer"
Does anyone know what I need to add to get this to compile?