Skip to content

Instantly share code, notes, and snippets.

@quephird
Last active October 5, 2015 22:55
Show Gist options
  • Save quephird/1b9e5fa4b2dbf2948c9c to your computer and use it in GitHub Desktop.
Save quephird/1b9e5fa4b2dbf2948c9c to your computer and use it in GitHub Desktop.
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