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
import Foundation | |
public protocol ComputedPropertyProvider { | |
var computedProperty:String { get} | |
} | |
public extension ComputedPropertyProvider { | |
var computedProperty: String { | |
return "this is computed property" | |
} |
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
firstLabel.topAnchor.constraintEqualToAnchor(self.view.topAnchor constant: 20).active = true |
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
secondLabel.topAnchor.constraintEqualToAnchor(firstLabel.topAnchor).active = true |
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
import UIKit | |
func addViewAndButton() { | |
// iOS 9 availability coolness | |
guard #available(iOS 9, *) else { | |
return | |
} | |
// boilerplate view creation |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
let scaleValues = ["10 feet", "100 feet", "100 yards", "400 yards", "800 yard", "1200 yards", "1 mile"] | |
var scaleLabels = [UILabel]() | |
for index in 0..<scaleValues.count { | |
var label = UILabel(frame: CGRectMake((CGFloat(index) + 1 * 100), 10, 100, 25)) |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
let scaleValues = ["10 feet", "100 feet", "100 yards", "400 yards", "800 yard", "1200 yards", "1 mile"] | |
var scaleLabels = [UILabel]() | |
for (scaleValueIndex, scaleValue) in scaleValues.enumerate() { | |
var label = UILabel(frame: CGRectMake((CGFloat(scaleValueIndex) + 1 * 100), 10, 100, 25)) |