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
| override func urlSession( | |
| _ session: URLSession, | |
| didReceive challenge: URLAuthenticationChallenge, | |
| completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { | |
| // 1 | |
| guard | |
| challenge.protectionSpace.host == baseURL.host, | |
| challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust, | |
| let trust = challenge.protectionSpace.serverTrust | |
| else { |
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 | |
| protocol Presenter: AnyObject { | |
| associatedtype T: VCLogic | |
| var viewController: T? { get set } | |
| } | |
| protocol VCLogic: UIViewController { | |
| func foo() | |
| } |
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
| desc "Build simulator" | |
| lane :build_simulator do | |
| cocoapods | |
| zip_path = "./#{app_target}.zip" | |
| Dir.mktmpdir do |dir| | |
| gym( | |
| scheme: app_debug_scheme, | |
| workspace: app_workspace, |
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
| final class FetchImageOperation: AsyncOperation { | |
| private(set) var result: Result<UIImage, Error>? | |
| private lazy var imageProvider = ImageProvider() | |
| private let imageID: String | |
| init(imageID: String) { | |
| self.imageID = imageID | |
| super.init() |
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 AsyncOperation: Operation { | |
| enum State: String { | |
| case ready, executing, finished | |
| fileprivate var keyPath: String { | |
| return "is" + rawValue.capitalized | |
| } | |
| } | |
| var state = State.ready { | |
| willSet { |
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
| // Services Layer | |
| final class EntityService: APIService, EntityServiceProtocol { | |
| typealias EntityCompletion = (Result<Entity, Error>) -> Void | |
| @discardableResult | |
| func createEntity(_ entity: Entity, completion: @escaping EntityCompletion) -> Progress { | |
| let endpoint = CreateEntityEndpoint(entity: entity) | |
| return apiClient.request(endpoint, completionHandler: completion) |
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 | |
| import Service | |
| import Database | |
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| let user = Service().getUsers() | |
| func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { |
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 | |
| import Service | |
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| let user = Service().getUsers() | |
| func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> 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
| import Foundation | |
| import Model | |
| public class Service { | |
| public init() {} | |
| public func getUsers() -> [User] { | |
| return [User(name: “Johny”)] | |
| } | |
| } |
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
| platform :iOS, ’13.0’ | |
| use_frameworks! | |
| target ‘ModuleExample’ do | |
| end | |
| target ‘Service’ do | |
| pod ‘Model’, :path => ‘Model’ | |
| end |
NewerOlder