- Introduction to Functional Programming Johannes Weiร - http://kcy.me/1ngiv
- ReactiveCocoa at MobiDevDay Andrew Sardone - http://kcy.me/1nhl3
- The Future Of ReactiveCocoa Justin Spahr-Summers - http://kcy.me/1nhs7
- Enemy of the State Justin Spahr-Summers - http://kcy.me/1njzs
- WWDC 2014 Session 229 - Advanced iOS Application Architecture and Patterns Andy Matuschak - http://kcy.me/1pyva
- Functioning as a Functionalist Andy Matuschak - http://kcy.me/22o45
- Controlling Complexity in Swift Andy Matuschak - http://kcy.me/23sc9
- Functional and reactive programming with Swift Ash Furrow -
###Let's install Vagrant###
- Install VirtualBox: https://www.virtualbox.org/
- Install Vagrant: http://vagrantup.com/
###Select a Vagrant Box from https://vagrantcloud.com###
#add it to your list of boxes
vagrant box add hashicorp/precise32
#create a new folder for your project & init vagrant
Starting from iOS 9, App Transport Security enforces to use secure HTTPS requests by default.
App Transport Security
App Transport Security (ATS) enforces best practices in the secure connections between an app and its back end. ATS prevents accidental disclosure, provides secure default behavior, and is easy to adopt; it is also on by default in iOS 9 and OS X v10.11. You should adopt ATS as soon as possible, regardless of whether youโre creating a new app or updating an existing one.
If youโre developing a new app, you should use HTTPS exclusively. If you have an existing app, you
// Monad | |
operator infix >>= { | |
precedence 10 | |
associativity left | |
} | |
struct _MReturn { | |
} | |
@transparent func _mreturn<Args>(a: Args) -> (_MReturn, Args) { | |
return (_MReturn(), a) |
import Foundation | |
struct Box<T> {} | |
protocol Functor { | |
typealias A | |
typealias B | |
typealias Boxed = Box<B> | |
func fmap<B>(f: A -> B) -> Boxed |
Copy and paste the swift code below into a playground to experiment.
This is a very close emulation of Functor and Monad typeclasses in swift. As of Swift 1.2 and Xcode 6.3, this is no longer very fragile.
Unfortunately, the compiler cannot verify the types when passing a function to (>>=)
. We have to wrap the function in a closure and call it with an explicit argument to compile.
optionalDoubles >>= squareRoot // doesn't compile
optionalDoubles >>= { squareRoot($0) } // compiles
extension NSHashTable: SequenceType { | |
public func generate() -> AnyGenerator<AnyObject> { | |
var array = self.allObjects | |
var nextIndex = array.count-1 | |
return anyGenerator { | |
if (nextIndex < 0) { | |
return nil |
import Cocoa | |
enum CoroutineState { | |
case Fresh, Running, Blocked, Canceled, Done | |
} | |
struct CoroutineCancellation: ErrorType {} | |
class CoroutineImpl<InputType, YieldType> { | |
let body: (yield: YieldType throws -> InputType) throws -> Void |
[db makeFunctionNamed:@"UTTypeConformsTo" maximumArguments:2 withBlock:^(sqlite3_context *context, int argc, sqlite3_value **argv) { | |
if (sqlite3_value_type(argv[0]) == SQLITE_TEXT) { | |
const unsigned char *a = sqlite3_value_text(argv[0]); | |
const unsigned char *b = sqlite3_value_text(argv[1]); | |
CFStringRef as = CFStringCreateWithCString(nil, (const char*)a, kCFStringEncodingUTF8); | |
CFStringRef bs = CFStringCreateWithCString(nil, (const char*)b, kCFStringEncodingUTF8); | |
sqlite3_result_int(context, UTTypeConformsTo(as, bs)); |
import Foundation | |
// Generic Error | |
public struct Error: ErrorType {let reason: String} | |
/** | |
Printing version of try? Call either with standard or autoclosure approach | |
``` | |
let contents = attempt{try NSFileManager.defaultManager().contentsOfDirectoryAtPath(fakePath)} | |
let contents = attempt{try NSFileManager.defaultManager().contentsOfDirectoryAtPath(XCPlaygroundSharedDataDirectoryURL.path!)} |