Good question. I also asked myself if there is such guideline.
I thought we have some kind of guideline, as parameters in methods/funcs in Swift has `func foo(param: Type)` format, not 'func foo(param : Type)'. So for myself I decided that I should follow this syntax anywhere I need to place `:`.

On 22.06.2016 14:40, Adrian Zubarev via swift-evolution wrote:
Should there be a design guideline rule for colons |:| in Swift?

I see people doing things like this:

|protocol A : B {} // VS. protocol A: B {} |

|func foo<T : A>() -> T { … } // VS. func foo<T: A>() -> T { … } |

|var value : Type // VS. var value: Type |

|[key1 : value1, key2 : value2] // VS. [key1: value1, key2: value2] |

  * I prefer the second style, where there is no whitespace between lhs and
    the |:| symbol and there is also a whitespace after |:|. Example:
    |something: somethingElse|



--
Adrian Zubarev
Sent with Airmail



_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to