Re: [swift-evolution] [Pitch] Adding safety to arrays

2017-05-07 Thread Andrew Hart via swift-evolution
To respond to one of the main points I’ve seen, which is that this isn’t necessary for arrays because the index you’re using is often tied to data related to the array, such as in the example I gave originally, where in `cellForRowAtIndexPath`, the index path is probably informed by the length of

[swift-evolution] [Pitch] Adding safety to arrays

2017-04-13 Thread Andrew Hart via swift-evolution
Recently I’ve been considering the lack of safety around array indexes. Swift is designed with safety in mind, so this example would not compile: var myString: String? = “hello” myString.append(“ world!”) The string is optional, not guaranteed to exist, so the last line requires a “!” to

[swift-evolution] Parameter names in closures in Swift 3 are no longer possible

2016-10-10 Thread Andrew Hart via swift-evolution
I’ve been a little dismayed to see that closures in Swift 3 no longer have parameter names. As an example, in Swift 2, a function with a completion block may look like this: func sendMessage(completion: (success: Bool, recipientID: String?, senderID: String?) -> Void) { //Oh no it failed