I only see the benefits on this.
1. We don't have to store all states in one file. States can be stored
separately. So, we can write code in more composition style.
2. We can add new states to the existing type. Not just NSObject subclass
with associated object.
protocol Incrementer{
func increase()
}
extension Incrementer{
var count = 1 //
allows stored properties
func increase(){
print(count)
count = count + 1
}
}
> On Dec 8, 2015, at 10:51 AM, Kevin Kachikian via swift-evolution
> <swift-evolution at
> swift.org<https://lists.swift.org/mailman/listinfo/swift-evolution>> wrote:
>
> I'd like to proposal to the Swift community and discuss the advantages and
> disadvantages of adding modifiable properties to extensions (in addition to
> the already existing computed properties, instance methods, subscripts, etc.):
>
> extension SomeType {
>
> var aNewProperty: Int
> var anotherVariable: String
> var aThirdOne: MyStruct
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution