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 Cocoa | |
// Only needed until we have class variables | |
var __SwizzleSayHello = { (who:String) -> String in | |
return "Hello, \(who)" | |
} | |
class Swizzle { | |
//Only needed until we have class variables | |
class var _sayHello : (String)->String { get{ return __SwizzleSayHello } set (swizzle) {__SwizzleSayHello = swizzle} } |
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
// | |
// IncrementalUpdateTests.swift | |
// | |
// Copyright (c) 2015 Swift Studies. All rights reserved. | |
// | |
import Foundation | |
import XCTest | |
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 Cocoa | |
func f1(x : Int) -> Int? { | |
return (x == 3) ? 1 : 3 | |
} | |
func f2(x : Int) -> Int? { | |
if x < 0 || x > 3 {return nil} |
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 BigData { | |
static func cache(from path:String)->Self | |
} | |
extension String : BigData { | |
public static func cache(from path: String) -> String { | |
return (try? String(contentsOfFile: path)) ?? "Could not load" | |
} |