Skip to content

Instantly share code, notes, and snippets.

@hyperspacemark
Last active August 29, 2015 14:28
Show Gist options
  • Save hyperspacemark/3e5b1d67995365d27e81 to your computer and use it in GitHub Desktop.
Save hyperspacemark/3e5b1d67995365d27e81 to your computer and use it in GitHub Desktop.
final class Controller: A {
var property: String = "" {
didSet {
for a in collectionOfA {
// Cannot assign to property: 'a' is a 'let' constant
a.property = property
}
}
}
var collectionOfA: [A] = []
}
// This protocol declaration causes the error to be thrown...
protocol A {
var property: String { get set }
}
// ...but marking it as a `class` protocol results in no error being raised.
protocol A: class {
var property: String { get set }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment