Sign in to FlowVella

Forgot password?
Sign in with Facebook

New? Create your account

Sign up for FlowVella

Sign up with Facebook

Already have an account? Sign in now


By registering you are agreeing to our
Terms of Service

Share This Flow

Loading Flow

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

“Functions are actually a special case of closures”*

Type may be inferred by context. Single expressions closures may omit return

Parameter names can be shortened to $0, $1, etc. Operator functions can be even briefer

Closures

* Syntax diagram, sample code, and quote from Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/us/jEUH0.l

var names = ["Neil", "Tim", "Kiran"]

var reversed : [ String ]


reversed = sorted(names, { (s1: String, s2: String) -> Bool in

  return s1 > s2

} )

reversed = sorted(names, { s1, s2 in s1 > s2 } )

reversed = sorted(names, { $0 > $1 } )

reversed = sorted(names, >)

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...
  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

  • 11

  • 12

  • 13

  • 14

  • 15

  • 16

  • 17

  • 18

  • 19

  • 20

  • 21

  • 22

  • 23

  • 24

  • 25

  • 26

  • 27

  • 28

  • 29

  • 30

Introduction to the Swift Language - Chicago Swift Developer Meetup

By Matt Houser

v 2015-04-13a