devxoul / Then

✨ Super sweet syntactic sugar for Swift initializers
MIT License
4.18k stars 290 forks source link

Cannot used with `struct` #16

Closed honghaoz closed 8 years ago

honghaoz commented 8 years ago

Seems like I cannot use Then on struct type:

struct SomeStruct {
    var name: String = ""
}

extension SomeStruct : Then {}

var aStruct = SomeStruct().then {
    $0.name = "123"
}

$0.name = "123" line throw an error: ...swift:43:10: Cannot assign to property: '$0' is a 'let' constant

devxoul commented 8 years ago

@honghaoz, #18 fixes the issue and has been shipped with 1.0.0 release :smile:

honghaoz commented 8 years ago

great! thanks :+1: