devxoul / Then

✨ Super sweet syntactic sugar for Swift initializers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot used with `struct`

honghaoz opened this issue · comments

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

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

great! thanks 👍