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
// See https://www.natashatherobot.com/swift-configuring-a-constant-using-shorthand-argument-names/ for more info. | |
public enum TaxiServiceType:CustomStringConvertible | |
{ | |
case Uber | |
case BlackCab | |
public var description: String { | |
switch self { | |
case .BlackCab: |
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
// | |
// SLComposable.swift | |
// SocialFrameworkRef | |
// | |
// Created by Stuart Breckenridge on 24/05/2016. | |
// Copyright © 2016 Stuart Breckenridge. All rights reserved. | |
// | |
import Foundation | |
import Social |
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
protocol AmountConversions | |
{ | |
// Convert Mls | |
func convertMlsToUKFLOz(mls:Int) -> NSNumber // mls * 0.035195 | |
func convertMlsToUSFLOz(mls:Int) -> NSNumber // mls * 0.033814 | |
// Convert UKFLOz | |
func convertUKFLOzToMls(ukfloz:Float) -> NSNumber // uk fl oz / 0.035195 | |
func convertUKFLOzToUSFLOz(ukfloz:Float) -> NSNumber // uk fl oz * 0.96076 | |
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
protocol ExcutableQueue { | |
var queue: dispatch_queue_t { get } | |
} | |
extension ExcutableQueue { | |
func execute(closure: () -> Void) { | |
dispatch_async(queue, closure) | |
} | |
} |
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
protocol UIAlertControllerErrorDisplay | |
{ | |
func showAlertControllerWithError(error:NSError) | |
} | |
extension UIViewController:UIAlertControllerErrorDisplay | |
{ | |
func showAlertControllerWithError(error:NSError) | |
{ | |
NSOperationQueue.mainQueue().addOperationWithBlock { () -> Void in |
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
class NumberGenerator | |
{ | |
class func generateLottoNumbers(#count:Int,maxRange:UInt32, duplicatesAllowed:Bool = false) -> ([Int]) | |
{ | |
var i = 0 | |
var uniqueSet = NSMutableSet(capacity: count) | |
var numberArray1 = [Int]() | |
do{ | |
var genNumber = (Int(arc4random() % maxRange + 1)) |
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
// | |
// GameCenterInteractor.swift | |
// GameKitInteraction | |
// | |
// Created by Stuart Breckenridge on 19/11/14. | |
// Copyright (c) 2014 Stuart Breckenridge. All rights reserved. | |
// | |
import UIKit | |
import GameCenter |
NewerOlder