This file contains 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 ListMovieViewModel {} | |
class ListMovieController { | |
private let viewModel: ListMovieViewModel | |
init(viewModel: ListMovieViewModel) { | |
self.viewModel = viewModel | |
} | |
This file contains 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 HTTPClient { | |
var session: URLSession = .shared | |
init() {} | |
} | |
let client = HTTPClient() | |
client.session = URLSession(configuration: .ephemeral) |
This file contains 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 APIServce { | |
..... | |
func load(url: URL, completion: @escaping (Result<Article, Error>) -> Void) { | |
// fetch articles from remote | |
} | |
} |
This file contains 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 Loader {} | |
class RemoteLoader: Loader {...} | |
class LocalLoader: Loader {...} | |
class ViewControllerA { | |
private var loader: Loader? | |
init(){ |
This file contains 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 Strategy { | |
func algorithm() | |
} | |
class ConcreteStrategyA: Strategy { | |
func algorithm() {...} | |
} | |
class ConcreteStrategyB: Strategy { | |
func algorithm() {...} |
This file contains 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 PostViewController { | |
private let loader: Loader | |
init(loader: Loader){ | |
self.loader = loader | |
} | |
func loadFeed(){ | |
loader.load() | |
} |
This file contains 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 CompositeStrategy : Strategy { | |
let wifiLoader: WifiLoader | |
let cellularLoader: CellularLoader | |
let localLoader: LocalLoader | |
init(wifiLoader: WifiLoader, cellularLoader: CellularLoader, localLoader: LocalLoader){ | |
self.wifiLoader = wifiLoader | |
self.cellularLoader = cellularLoader | |
self.localLoader = localLoader | |
} |
This file contains 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
let wifiLoader = WifiLoader(url: URL(string: http://api.com/wifi/posts)!) | |
let cellularLoader = CellularLoader(url: URL(string: http://api.com/wifi/cellular)!) | |
let localLoader = LocalLoader() | |
let compositeLoader = CompositeStrategy(wifiLoader: wifiLoader, cellularLoader: cellularLoader, localLoader: localLoader) | |
let viewController = PostViewController(loader: compositeLoader) |
This file contains 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 ProfileSectionControllerProtocol { | |
var title: String {get} | |
var cells: [ProfileCellProtocol] {get set} | |
var rowCount: Int {get} | |
init(title: String, cells: [ProfileCellProtocol]) | |
} |
This file contains 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 ProfileCellProtocol { | |
func view(_ tableView: UITableView) -> UITableViewCell | |
} |
OlderNewer