(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| // | |
| // AutoLocalize.h | |
| // AutoLocalize | |
| // | |
| // Created by Stefan Matthias Aust on 05.08.11. | |
| // Copyright 2011 I.C.N.H. All rights reserved. | |
| // | |
| #import <UIKit/UIKit.h> |
| // | |
| // AVAsset+VideoOrientation.h | |
| // | |
| // Created by Luca Bernardi on 19/09/12. | |
| // Copyright (c) 2012 Luca Bernardi. All rights reserved. | |
| // | |
| #import <AVFoundation/AVFoundation.h> | |
| typedef enum { | |
| LBVideoOrientationUp, //Device starts recording in Portrait |
| #import <Foundation/Foundation.h> | |
| #define trait(NAME) protocol NAME;\ | |
| @interface id_##NAME @end \ | |
| typedef id_##NAME<NAME> NAME; \ | |
| @protocol NAME | |
| #define trait_implementation(NAME) \ | |
| interface NAME##_impl : NSObject<NAME>\ | |
| - (NAME *) asTrait$;\ |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| class Regex { | |
| let pattern: String | |
| let options: NSRegularExpressionOptions! | |
| private var matcher: NSRegularExpression { | |
| return NSRegularExpression(pattern: self.pattern, options: nil, error: nil) | |
| } | |
| required init(pattern: String, options: NSRegularExpressionOptions = nil) { | |
| self.pattern = pattern |
| //: Playground - noun: a place where people can play | |
| import UIKit | |
| var str = "Hello, playground" | |
| class ServiceLocator { | |
| private var registry : [String: Any] = [:] | |
| func registerService<T>(service: T) { |
| //: Playground - noun: a place where people can play | |
| import UIKit | |
| // Simple struct to be fullfilled from JSON | |
| struct User { | |
| let name: String | |
| let age: Int | |
| } |
| ; ModuleID = 'main.m' | |
| target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" | |
| target triple = "x86_64-apple-macosx10.11.0" | |
| %0 = type opaque | |
| %struct._class_t = type { %struct._class_t*, %struct._class_t*, %struct._objc_cache*, i8* (i8*, i8*)**, %struct._class_ro_t* } | |
| %struct._objc_cache = type opaque | |
| %struct._class_ro_t = type { i32, i32, i32, i8*, i8*, %struct.__method_list_t*, %struct._objc_protocol_list*, %struct._ivar_list_t*, i8*, %struct._prop_list_t* } | |
| %struct.__method_list_t = type { i32, i32, [0 x %struct._objc_method] } | |
| %struct._objc_method = type { i8*, i8*, i8* } |
| //: [Previous](@previous) | |
| import Foundation | |
| // One per function | |
| final class Stub { | |
| let name: String | |
| let cmp: (AnyCall, AnyCall) -> Bool | |
| init(name: String, cmp: (AnyCall, AnyCall) -> Bool) { | |
| self.name = name |
| //download.js v3.0, by dandavis; 2008-2014. [CCBY2] see http://danml.com/download.html for tests/usage | |
| // v1 landed a FF+Chrome compat way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime | |
| // v2 added named files via a[download], msSaveBlob, IE (10+) support, and window.URL support for larger+faster saves than dataURLs | |
| // v3 added dataURL and Blob Input, bind-toggle arity, and legacy dataURL fallback was improved with force-download mime and base64 support | |
| // data can be a string, Blob, File, or dataURL | |