mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
We are building the class layout based on this type which expects archetypes. rdar://61751511
35 lines
737 B
Swift
35 lines
737 B
Swift
@propertyWrapper
|
|
public struct Wrapper<Value> {
|
|
var value: Value
|
|
|
|
public init(wrappedValue: Value) {
|
|
self.init(initialValue: wrappedValue)
|
|
}
|
|
|
|
public init(initialValue: Value) {
|
|
value = initialValue
|
|
}
|
|
|
|
public var wrappedValue: Value {
|
|
get { fatalError("unreachable") }
|
|
set { fatalError("unreachable") }
|
|
}
|
|
|
|
public static subscript<T: AnyObject>(
|
|
_enclosingInstance object: T,
|
|
wrapped wrappedKeyPath: ReferenceWritableKeyPath<T, Value>,
|
|
storage storageKeyPath: ReferenceWritableKeyPath<T, Self>
|
|
) -> Value {
|
|
get {
|
|
object[keyPath: storageKeyPath].value
|
|
}
|
|
set {
|
|
object[keyPath: storageKeyPath].value = newValue
|
|
}
|
|
}
|
|
}
|
|
|
|
open class ResilientBase {
|
|
public init() {}
|
|
}
|