Closed aenewton closed 8 years ago
I use the second one typically. Not really a fan of []()
I am a fan of using literals when possible. This goes for dictionaries as well
var foo: [String: Bar] = [:]
Second, seconded. Syntactic sugar types don't look right to me with parentheses hanging off the end. Agreed re: dictionaries.
You wouldn't say var foo = String?.None
, you'd say var foo: String? = nil
You all have managed to convince me. I'm now on board with the change.
Someone needs to go through ray's to look for updates/swift 3 updates before we add too many new issues, as this is also the preferred way mentioned there:
https://github.com/raywenderlich/swift-style-guide#type-annotation-for-empty-arrays-and-dictionaries
I believe this is now updated in the latest push to master.
@ianterrell and I were having a discussion about array property initialization, and I wanted to move that here. Currently, the style guide suggests using:
var names = [String]()
.Ian is suggesting we move to:
var names: [String] = []
Thoughts? I'm personally in favor of how we currently have it.