Created
March 17, 2020 12:15
-
-
Save KaQuMiQ/db9c651690d9a51e749c5fc96fe71b2f to your computer and use it in GitHub Desktop.
Set only property example
This file contains hidden or 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
| struct SomeType { | |
| private var store: Any = 0 // or something else to proxy properties | |
| var value: Any { | |
| @available(*, unavailable) | |
| get { fatalError("unavailable") } | |
| set { store = newValue} | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example
Might be useful in proxy for types where getting is hard or not available while avoiding
func setValue(...)