- Introduction to Functional Programming Johannes Weiß - https://vimeo.com/100786088
- ReactiveCocoa at MobiDevDay Andrew Sardone - https://vimeo.com/65637501
- The Future Of ReactiveCocoa Justin Spahr-Summers - https://www.youtube.com/watch?v=ICNjRS2X8WM
- Enemy of the State Justin Spahr-Summers - https://www.youtube.com/watch?v=7AqXBuJOJkY
- WWDC 2014 Session 229 - Advanced iOS Application Architecture and Patterns Andy Matuschak - https://developer.apple.com/videos/play/wwdc2014/229/
- Functioning as a Functionalist Andy Matuschak - https://www.youtube.com/watch?v=rJosPrqBqrA
- Controlling Complexity in Swift Andy Matuschak - https://realm.io/news/andy-matuschak-controlling-complexity/
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
public class FontLoader { | |
private enum Error: Swift.Error { | |
case error(String) | |
} | |
/// Register fonts | |
/// | |
/// - Parameter fonts: Font names | |
static func registerFonts(fonts: [String]) throws { | |
let bundle = Bundle(for: FontLoader.self) |
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 | |
public extension NSApplication { | |
public func relaunch(afterDelay seconds: TimeInterval = 0.5) -> Never { | |
let task = Process() | |
task.launchPath = "/bin/sh" | |
task.arguments = ["-c", "sleep \(seconds); open \"\(Bundle.main.bundlePath)\""] |
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
button.onTouchUpInside(context: self) { context in | |
// doStuff | |
} |
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
// We can't use `Character` or `String` ranges directly because they aren't countable | |
// Create a countable range of ASCII values instead | |
let range = UInt8(ascii: "a")...UInt8(ascii: "z") // CountableClosedRange<UInt8> | |
// Convert ASCII codes into Character values | |
range.map { Character(UnicodeScalar($0)) } // Array<Character> | |
// → ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] |
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
extension String { | |
var chomp : String { | |
mutating get { | |
self.removeAtIndex(self.startIndex) | |
return self | |
} | |
} | |
} | |
var test : String = "Chomp" |
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 | |
protocol Serializable { | |
static func deserializeInto(bytePtr: UnsafeMutablePointer<UInt8>, bytes: ArraySlice<UInt8>) -> ArraySlice<UInt8> | |
} | |
extension Serializable { | |
typealias WorkaroundSelf = Self | |
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
-(void) buttonClick:(NSButton *)sender { | |
// Create view controller | |
EXPopoverViewController *viewController = [[EXPopoverViewController alloc] init]; | |
// Create popover | |
NSPopover *entryPopover = [[NSPopover alloc] init]; | |
[entryPopover setContentSize:NSMakeSize(200.0, 200.0)]; | |
[entryPopover setBehavior:NSPopoverBehaviorTransient]; | |
[entryPopover setAnimates:YES]; | |
[entryPopover setContentViewController:viewController]; |
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 | |
// SendEmailWithAttachment | |
// | |
// Created by Kelly Egan on 3/17/15. | |
// Copyright (c) 2015 Kelly Egan. All rights reserved. | |
// | |
import UIKit | |
import MessageUI |
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
// OptionalBinding.swift | |
// as seen in http://nshipster.com/swift-1.2/ | |
// | |
// (c) 2015 Nate Cook, licensed under the MIT license | |
let a: Int? = 10 | |
let b: Int? = 5 | |
let c: Int? = 3 | |
let d: Int? = -2 | |
let e: Int? = 0 |
NewerOlder