IntrepidPursuits/swift-style-guide

[Proposal] Dictionaries

Closed this issue · 2 comments

Currently prefers colon against key like:

let thing: [String: String] = [
    "key": "value"
]

Proposal to have space on either side:

let thing: [String : String] = [
    "key" : "value"
]

👍
To me it should look similar to math spacing. 1 + 1 as opposed to 1+1 or 1+ 1

Looks good to me too. My only devil's advocate argument against the proposal would be that dictionary : spacing would be different than function argument-type spacing:

func doSomething(argument: Type)

Personally I don't feel strongly that they need to be consistent, but I think that's the only real argument I could think of in favor of the current style.