A question of property wrapper

@available(iOS 11.0, *)
struct T {}

@propertyWrapper
struct Wrapper<Value> {
    var wrappedValue: Value
}

struct Test {
    @available(iOS 11.0, *)
    @Wrapper var a: T // this is ok
    
    @available(iOS 11.0, *)
    @Wrapper<T> var b: T // 'T' is only available in iOS 11.0 or newer
}

what is the difference between a and b?

That looks like a bug to me. Neither of them are okay, since it implies that on a pre-iOS-11 system the storage layout of the struct might be different, and that's not [currently] something Swift supports.

Terms of Service

Privacy Policy

Cookie Policy