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...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Downloading Image /

loading...

Properties may have getters and setters

Properties may be calculated

Objects: Properties

protocol Exercising {

  var heartRateIncrement : Int { get set }

  func describe() -> String

}


class Sprint : Exercising {

  var isWindSprint : Bool {

    get {

      return heartRateIncrement > 40

    }

  }

  init() {

    heartRateIncrement = 30

  }

    

  var heartRateIncrement : Int {

    willSet (newIncrementor) {

      println("About to set incrementor to \(newIncrementor)")

    }

    didSet {

      println("Set incrementor to \(heartRateIncrement)")

    }

  }

  func describe() -> String {

    if isWindSprint {

      return "Windsprinting"

    } else {

      return "Sprinting"

    }

  }

}

Properties may have observers that monitor when a value is about to, or has just changed

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