Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions dogClass
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Playground - noun: a place where people can play

import UIKit




class Dog {
let name: String
let color: UIColor

init(name: String, color: UIColor) {
self.name = name
self.color = color
}

func speak() {
println("Ruff!")
}

func sit() {
println("I'm \(name) and I'm sitting :)")
}

class func genus() -> String {
return "Canis"
}

}



let white = UIColor.whiteColor()
let spunky = Dog(name: "Spunky", color: white)
spunky.speak()
spunky.sit()

let lightBrown = UIColor(hue: 0.1, saturation: 0.4, brightness: 0.8, alpha: 1)
let buddy = Dog(name: "Buddy", color: lightBrown)
buddy.speak()
buddy.sit()


let genusOfDog = Dog.genus()
println("All dogs belong to the \(genusOfDog) genus.")