- 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 hidden or 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 | |
/// Abstract functional list type | |
/// | |
/// Concrete types are EmptyList<T> and Cons<T> | |
public class List<T>: SequenceType { | |
/// Return true if this is an empty list, false if not | |
public var isEmpty: Bool { return true } |
This file contains hidden or 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
// | |
// CollectionViewDataSource.swift | |
// Khan Academy | |
// | |
// Created by Andy Matuschak on 10/14/14. | |
// Copyright (c) 2014 Khan Academy. All rights reserved. | |
// | |
import UIKit |
This file contains hidden or 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 UIViewController { | |
func performSegue<T:RawRepresentable where T.RawValue==String>(identifier: T, sender: AnyObject?) | |
self.performSegueWithIdentifier(identifier.rawValue, sender: sender) | |
} | |
} |
This file contains hidden or 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
------------ | |
Conformances | |
------------ | |
protocol AbsoluteValuable | |
Conformances: | |
Comparable | |
IntegerLiteralConvertible | |
SignedNumberType |
This file contains hidden or 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
func passAnyObject(param: AnyObject) { | |
print(param) | |
} | |
class MyClass {} | |
struct MyStruct {} | |
let a: Int = 1 | |
let b = 2.0 |
This file contains hidden or 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
// | |
// Signal+Extensions.swift | |
// Khan Academy | |
// | |
// Created by Nacho Soto on 10/1/15. | |
// Copyright © 2015 Khan Academy. All rights reserved. | |
// | |
import ReactiveCocoa |
A common task when developing iOS apps is to register custom cell subclasses for both UITableView
and UICollectionView
. Well, that is if you don’t use Storyboards, of course.
Both UITableView
and UICollectionView
offer a similar API to register custom cell classes:
public func registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)
This file contains hidden or 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 TableValuable { | |
associatedtype TableItem | |
static func loadingValue() -> TableItem | |
static func failedValue() -> TableItem | |
func value() -> TableItem | |
} | |
enum TableState<T: TableValuable> { | |
case Loading | |
case Failed |
This file contains hidden or 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
makeBitString :: Int -> [String] | |
makeBitString 0 = [] | |
makeBitString 1 = ["0","1"] | |
makeBitString w = map ('0':) (makeBitString (w-1)) ++ map ('1':) (makeBitString (w-1)) | |
makeMaskZeroString :: Int -> [String] | |
makeMaskZeroString w = ((map oneToMask) . makeBitString) w | |
where | |
oneToMask :: String -> String | |
oneToMask = (map (\c -> if c == '1' then '*' else c)) |