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 | |
struct URLEncodedString { | |
private (set) var encodedString: String | |
init(_ string: String) { | |
self.encodedString = URLEncodedString.URLEncode(string) | |
} |
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
// | |
// CoreDataStackInMemory.swift | |
// TripPlanner | |
// | |
// Created by Benjamin Encz on 7/20/15. | |
// Copyright © 2015 Make School. All rights reserved. | |
// | |
// Structure is inspired by: http://martiancraft.com/blog/2015/03/core-data-stack/, Thanks! |
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
struct Car: StringLiteralConvertible { | |
enum CarType: String { | |
case Mercedes, Porsche, Ford, Unknown | |
} | |
var type: CarType | |
typealias ExtendedGraphemeClusterLiteralType = StringLiteralType | |
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 | |
class User: NSObject { | |
dynamic var name: String? | |
} | |
class Observer: NSObject { | |
var user: User | |
init(user: User) { |
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 | |
struct Term { | |
let offset: Int | |
let value: String | |
} | |
let term = Term(offset: 0, value: "") | |
let output = generateEquatable(term) | |
print(output) |
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 | |
protocol APIClientProtocol { | |
init() | |
init(urlSession: NSURLSession) | |
init(apiKey: String) | |
init(urlSession: NSURLSession, apiKey: String) |
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
// Multicast delegate prototype. Better solution in Obj-C here: http://arielelkin.github.io/articles/objective-c-multicast-delegate/ | |
// Implementations | |
class CarListener: Hashable { | |
var hashValue = Int(arc4random()) | |
func receivedNoise(noiseEmitter: CarListenable) { | |
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 | |
var str = "Hello, playground" | |
let greeting: String = "hello, world!" | |
let capitalizedGreeting = greeting.capitalizedString | |
let testString = "👴🙅HahaśāGœ" |
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 | |
/* | |
Compiler Error: | |
candidate exactly matches | |
func doSomething() { | |
^ | |
*/ | |
struct A:B,C { |
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
var a: String? = "a" | |
var b: String? = "b" | |
func twoParamFunction(a: String)(b:String) { | |
println("\(a)\(b)") | |
} | |
a.map(twoParamFunction).map { b.map($0)} |