Last active
August 29, 2015 14:02
-
-
Save langford/7e682d04f8f9ddead708 to your computer and use it in GitHub Desktop.
Multiple methods with same type but different method param names. Still basically objective c style.
This file contains 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
// | |
// ViewController.swift | |
// Silverton Resource Tracker | |
// | |
// Created by Michael Langford on 6/2/14. | |
// Copyright (c) 2014 Rowdy Labs LLC. All rights reserved. | |
// | |
import UIKit | |
class Square { | |
var sideLength: Double | |
init(sideLength: Double, name: String) { | |
self.sideLength = sideLength | |
} | |
init(sideSlipperyness: Double, name: String) { | |
self.sideLength = 45; | |
} | |
func area() -> Double { | |
return sideLength * sideLength | |
} | |
} | |
class ViewController: UIViewController { | |
@IBOutlet var metalsView : UIView | |
@IBOutlet var coalView : UIView | |
@IBOutlet var lumberView : UIView | |
@IBOutlet var newGameButton : UIButton | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
self.lumberView.backgroundColor = UIColor.redColor() | |
self.coalView.backgroundColor = UIColor.blackColor() | |
self.metalsView.backgroundColor = UIColor.blueColor() | |
let s1:Square = Square(sideLength:3,name:"blurt"); | |
let s2:Square = Square(sideSlipperyness:10000,name:"9"); | |
println(s1.area()) | |
println(s2.area()) | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment