Created
January 6, 2020 13:55
-
-
Save 4brunu/fe5f7ff855a1ff6fdd1528d96232b720 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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