Last active
October 5, 2015 22:55
-
-
Save quephird/1b9e5fa4b2dbf2948c9c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
class Vehicle { | |
lazy var isWarmedUp: Bool = self.start() | |
var color: String? | |
var maxSpeed = 80 { | |
willSet(s) { | |
print("Changing max speed from \(s)...") | |
} | |
didSet(s) { | |
print("to \(s)") | |
} | |
} | |
func start() -> Bool { | |
NSThread.sleepForTimeInterval(3) | |
print("Car is started and warmed up!") | |
return true | |
} | |
func description() -> String { | |
return "A \(self.color) vehicle" | |
} | |
func travel() { | |
print("Traveling at \(maxSpeed) kph") | |
} | |
deinit { | |
print("AAaaaaaaaa!!!!") | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment