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 RemoteMovie adalah model yang merupakan representatif | |
| // data JSON data yang kita dapat dari API. | |
| // Cek API : https://ghibliapi.herokuapp.com/films | |
| struct RemoteMovie: Decodable { | |
| let id, title, original_title, original_title_romanised: String | |
| let image, movie_banner: URL | |
| let description, director, producer, release_date: String | |
| let running_time, rt_score: String | |
| let people, species, locations, vehicles: [String] | |
| let url: 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
| protocol Service{ | |
| func start() | |
| func stop() | |
| } | |
| class MyService: Service { | |
| func stop() { | |
| fatalError(”Cannot stop”) | |
| } |
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 LogFileSaver { | |
| private let fileName: String | |
| public init(fileName: String) { | |
| self.fileName = fileName | |
| } | |
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
| public final class NewsUIComposer { | |
| private init() {} | |
| public static func newsComposedWith(newsLoader: NewsLoader, categoryLoader: NewsCategoryLoader, imageLoader: ImageDataLoader) -> NewsViewController { | |
| let newsPresentationAdapter = NewsLoaderPresentationAdapter(newsLoader: MainQueueDispatchDecorator(decoratee: newsLoader)) | |
| let newsCategoryPresentationAdapter = NewsCategoryPresentationAdapter(categoryLoader: MainQueueDispatchDecorator(decoratee: categoryLoader)) | |
| let newsController = makeNewsViewController(newsDelegate: newsPresentationAdapter, newsCategoryDelegate: newsCategoryPresentationAdapter) | |
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 NewsViewAdapter: NewsView { | |
| private weak var controller: NewsViewController? | |
| private let imageLoader: ImageDataLoader | |
| init(controller: NewsViewController, imageLoader: ImageDataLoader) { | |
| self.controller = controller | |
| self.imageLoader = imageLoader | |
| } | |
| func display(_ viewModel: NewsViewModel) { |
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 NewsModule | |
| protocol NewsCellControllerDelegate { | |
| func didRequestImage() | |
| func didCancelImageRequest() | |
| } | |
| enum NewsTableCellViewType: 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
| import UIKit | |
| import NewsModule | |
| protocol NewsViewControllerDelegate { | |
| func didRequestNewsRefresh(request: PagedNewsRequest) | |
| } | |
| protocol NewsCategoryViewControllerDelegate { | |
| func didRequestNewsCategory() | |
| } |
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
| // | |
| // Auth.swift | |
| // KipasKipasNetworking | |
| // | |
| // Created by PT.Koanba on 31/03/22. | |
| // | |
| import Foundation | |
| public class AuthenticatedHTTPClientDecorator: HTTPClient { |
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 | |
| public class AuthenticatedHTTPClientDecorator: HTTPClient { | |
| public typealias Result = HTTPClient.Result | |
| private let decoratee: HTTPClient | |
| private let cache: TokenStore | |
| private let loader: TokenLoader | |
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
| public class AuthenticatedHTTPClientDecorator: HTTPClient { | |
| public typealias Result = HTTPClient.Result | |
| private let decoratee: HTTPClient | |
| private let cache: TokenStore | |
| private let loader: TokenLoader | |
| public init(decoratee: HTTPClient, cache: TokenStore, loader: TokenLoader) { | |
| self.decoratee = decoratee |