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 CodableInit { | |
| init(data: Data) throws | |
| } | |
| extension CodableInit where Self: Codable { | |
| init(data: Data) throws { |
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 HandleAlamoResponse { | |
| /// Handles request response, never called anywhere but APIRequestHandler | |
| /// | |
| /// - Parameters: | |
| /// - response: response from network request, for now alamofire Data response | |
| /// - completion: completing processing the json response, and delivering it in the completion handler | |
| func handleResponse<T: CodableInit>(_ response: DataResponse<Data>, completion: CallResponse<T>) | |
| } | |
| extension HandleAlamoResponse { |
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
| UserRouter.login(email: "ali@ali.gmail.com", password: "test12345").send(SwiftCairoUser.self) {[weak self] (response) in | |
| switch response { | |
| case .failure(let error): | |
| // TODO: - Handle error as you want, printing isn't handling. | |
| print(error) |
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 | |
| // MARK: - Date Format & Components | |
| extension Date { | |
| // MARK: - Helper types | |
| enum Format: String, CaseIterable { | |
| /// 15/03/2022, 11:02 AM | |
| case ddMMyyyyHHmmA = "dd/MM/yyyy, HH:mm a" | |
| /// "18/10/1993" | |
| case ddMMyyyySlashed = "dd/MM/yyyy" |
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 | |
| class Model { | |
| let id: String | |
| let link: String | |
| let resizedLink: String | |
| func toDao() -> ModelDAO { | |
| let dao: ModelDAO = .init() | |
| // properties injection |
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 UIKit | |
| enum WidgetType { | |
| case search | |
| case banner | |
| } | |
| class Interactor { | |
| func buildWidgets() { |
OlderNewer