devxoul / Then

✨ Super sweet syntactic sugar for Swift initializers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggestion: Then? Why not With?

mattijsf opened this issue · comments

Nice idea!

I personally suggest a different keyword: .with { ... }

UILabel().with {
    $0.textColor = .blackColor() 
} 

Makes a bit more sense.

The keword/idea reminds me a bit of the old VB's With...End With statement: https://msdn.microsoft.com/en-us/library/wc500chb.aspx

Hi @mattijsf!
Why I chose then instead of with is to avoid name conflicts. Because with() is more general than then(). That means, other frameworks might have with() already.

Okay! Sounds like you already gave it a thought :)