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 Focus // https://github.com/typelift/Focus | |
| struct Foo { | |
| let bar: Int | |
| let baz: Bool | |
| static let bar = SimpleLens(get: { | |
| $0.bar | |
| }, set: { (oldFoo, newBar) in | |
| Foo(bar: newBar, baz: oldFoo.baz) |
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 UIKit | |
| private let UnknownNibName = "" | |
| protocol NibLoadable: class { | |
| typealias Object | |
| static var nibName: String { get } | |
| static func nib(name: String) throws -> UINib | |
| static func firstObjectFromNib(nib: UINib) throws -> Object |
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
| class ExternalClass {} | |
| extension ExternalClass { | |
| struct Namespace { | |
| static func method() { | |
| print("namespaced method call") | |
| } | |
| } | |
| } |
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
| $ docker pull host:5000/image #fails | |
| $ ssh -N -L 5000:host:5000 user@host | |
| $ docker pull localhost:5000/image #works |
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
| class Container<T> { | |
| private var containedValue: T | |
| init(_ value: T) { | |
| containedValue = value | |
| } | |
| } | |
| protocol ContainerProtocol { | |
| typealias ValueType |
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 Example { } | |
| struct SharedExample<T>: Example { | |
| let closure: ((T)) -> () | |
| init(_ closure: ((T)) -> ()) { | |
| self.closure = closure | |
| } | |
| } | |
| class World { |
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 "Service.h" | |
| @implementation AppDelegate | |
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
| [NLServiceLocator registerService:[[Service alloc] init]]; | |
| } | |
| @end |
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
| RF_ATTRIBUTE(RFWebService, serviceRoot = @"http://api.myproduct.com/") | |
| @interface MyWebService : RFWebServiceClient //Service need to be inherited from RFWebServiceClient as it responsible for resolving web service call methods defined by attributes. | |
| RF_ATTRIBUTE(RFWebServiceCall, method = @"GET", relativePath = @"resource/%%0%%" prototypeClass = [MyWebServiceResponse class]) //RelativePath used to map defined method relatively to serviceRoot provided earlier. Templating that defined by %% maps method parameters into call URL. Prototype class used for proper serialization of web service responses. | |
| RF_ATTRIBUTE(RFWebServiceHeader, headerFields = @{@"Text" : %%1%%}) //The same templathing mechanism could be used for mapping header fields | |
| - (id<RFWebServiceCancellable>)webCallURLParam:(NSString *)urlParam headerParam:(NSString *)headerParam (void(^)(MyWebServiceResponse result))successBlock failure:(void(^)(NSError *error))failureBlock; //Implementation of method not required as behavior defined by attributes, |