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 | |
| fileprivate protocol CancellableOperation { | |
| func cancelOperation() | |
| } | |
| extension Task: CancellableOperation { |
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 CustomTabBarController: UITabBarController { | |
| private var customMaxItems: CGFloat { | |
| get { | |
| self.value(forKey: "_customMaxItems") as! CGFloat | |
| } | |
| set { | |
| self.setValue("_customMaxItems", forKey: key) | |
| } |
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 | |
| final class TransitionDelegate: NSObject, | |
| UIViewControllerTransitioningDelegate { | |
| private let interactiveController = UIPercentDrivenInteractiveTransition() | |
| private let duration = CATransaction.animationDuration() | |
| func presentationController(forPresented presented: UIViewController, |
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
| RickAndMortyService.CharacterRoute.searchBy(id: 2) { character, error in | |
| } | |
| RickAndMortyService.CharacterRoute.searchWith(filters: [.name("morty")]) { characters, error in | |
| } |
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
| struct Info: Decodable { | |
| let count: Int | |
| let pages: Int | |
| let next: String? | |
| let prev: String? | |
| } |
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
| static func searchBy(id: Int, completion: @escaping(Character?, Error?) -> ()) { | |
| manager.sendRequest(route: Self.id(id), decodeTo: Character.self) { completion($0, $1)} | |
| } | |
| static func searchWith(filters: [Filters], completion: @escaping([Character]?, Error?) -> ()) { | |
| struct SearchWithFiltersResponse: Decodable { | |
| let info: Info | |
| let results: [Character] | |
| } |
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
| struct Character: Codable { | |
| let id: Int | |
| let name: String | |
| let status: String | |
| let url: String | |
| let species: String | |
| let type: String | |
| let gender: String | |
| } |
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
| enum RickAndMortyService { | |
| static let baseURL = "https://rickandmortyapi.com/api/" | |
| } |
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
| enum RickAndMortyService { | |
| static let baseURL = "https://rickandmortyapi.com/api/" | |
| static let manager = NetworkManager(baseURL: baseURL) | |
| } |
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
| extension RickAndMortyService { | |
| enum CharacterRoute: RouteProtcol { | |
| case id(Int) | |
| case base([Filters]) | |
| var stringValue: String { | |
| switch self { | |
| case .id(let id): | |
| return "character/\(id)" |
NewerOlder