Skip to content

Instantly share code, notes, and snippets.

@4brunu
Created January 6, 2020 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 4brunu/fe5f7ff855a1ff6fdd1528d96232b720 to your computer and use it in GitHub Desktop.
Save 4brunu/fe5f7ff855a1ff6fdd1528d96232b720 to your computer and use it in GitHub Desktop.
@propertyWrapper
open class PropertyWrapperWithOpenInit {
var _value: String
open init(wrappedValue: String) { // error: only classes and overridable class members can be declared 'open'; use 'public'
self._value = wrappedValue
}
open var wrappedValue: String {
get {
return _value
}
set {
_value = newValue
}
}
}
@propertyWrapper
open class PropertyWrapperWithoutOpenInit {
var _value: String
public init(wrappedValue: String) { // error: public initializer 'init(wrappedValue:)' cannot have more restrictive access than its enclosing property wrapper type 'PropertyWrapperWithoutOpenInit' (which is open)
self._value = wrappedValue
}
open var wrappedValue: String {
get {
return _value
}
set {
_value = newValue
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment