Compilation failed for property wrappers with codable in multiple files.
I found test codes in Swift source below:
@propertyWrapper
struct Printed<Value: Codable>: Codable {
var wrappedValue: Value {
didSet { print(wrappedValue) }
}
}
struct Foo: Codable {
@Printed var bar: Bool = false
}
func test(_ value: Foo = Foo()) {
let _: Codable = value
}
and use them in my test project:
But compilation failed with error:
Type 'Foo' does not conform to protocol 'Encodable'
How to fix it?