New to Swift 3.0

For work I have to update my project from Swift 2.3 to Swift 3.0.  Here are some changes I noticed:


Any (vs. AnyObject)

“_” as the first parameter





 1. @escape

Before Swift 3.0, all closures where @escape by default.  This means that it would be possible to pass information or effect properties outside of the closure.  For example, we could update a class property within the closure.  Prior to 3.0 we would have to put the @noescape keywords before the closure parameter.  With Swift 3.0 @noescape is the default and if we want to change a property outside of the closure we have to specify using the keyword “@escape” before the closure parameter in a function.

2. Any

AnyObject is used as a sort of generic way to refer to any possible class type object.  “Any” is used to be even more generalized.

3.  “_ ” as first parameter


This is just a way for Apple to tell us that they first will not be written out,:


func myNiftyMethod(_ input: String) -> Void {

//Do nifty stuff


var niftyText: String = “niffftttty”


otherwise it would look like this:

func myNiftyMethod(input: String) -> Void {

//Do nifty stuff


var niftyText: String = “niffftttty”

myNiftyMethod(input: niftyText)


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>