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 | |
| var model = Model(name: "Alex") // Model(name: "Alex") | |
| model.name = "Hello" // error: cannot assign to property: 'name' setter is inaccessible | |
| model[keyPath: \.name] = "Serge" // error: cannot assign through subscript: key path is read-only | |
| let newModel = Model.lens.name.set("Serge")(model) // Model(name: "Serge") |
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 AutoMockable {} | |
| protocol Additive: AutoMockable { | |
| func add(a: Int, b: Int) -> Int | |
| } |
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
| erase_sim: | |
| ./reset_sim.sh 2>/dev/null; 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
| - didFinishAppLaunch | |
| { | |
| ServiceLocator* serviceLocator = [ServiceLocator new]; | |
| SomeService* someService = [SomeService new]; | |
| [serviceLocator useObject:someService asServiceForKind:[someService class]]; | |
| SomeViewController* vc = [SomeViewController new]; | |
| vc.serviceLocator = serviceLocator; | |
| } |
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
| // UIImage+Resize.h | |
| // Created by Trevor Harmon on 8/5/09. | |
| // Free for personal or commercial use, with or without modification. | |
| // No warranty is expressed or implied. | |
| // Extends the UIImage class to support resizing/cropping | |
| @interface UIImage (Resize) | |
| - (UIImage *)croppedImage:(CGRect)bounds; | |
| - (UIImage *)thumbnailImage:(NSInteger)thumbnailSize | |
| transparentBorder:(NSUInteger)borderSize |