Skip to content

Instantly share code, notes, and snippets.

@gracietti
Last active April 7, 2017 14:54
Show Gist options
  • Save gracietti/b86a1c5e0e6c7395affa31200f69a7f3 to your computer and use it in GitHub Desktop.
Save gracietti/b86a1c5e0e6c7395affa31200f69a7f3 to your computer and use it in GitHub Desktop.
Example of Contract
import Foundation
protocol MainSearchView: BaseView {
func showCustomError(_ message: String?)
func updateVisibility(onSearchController willBeActive: Bool)
func showSearchResult(_ products: [Product]?, shouldAppend: Bool)
}
protocol MainSearchPresentation: class {
func onViewDidLoad()
func onWillPresentSearchController()
func onSearchTermChanged(to searchTerm: String)
func onProductFavoriteChanged(_ product: Product, to isFavorite: Bool)
func onProductSelected(_ product: Product)
func onInfiniteScrollTriggered()
}
protocol MainSearchUseCase: class {
func searchProducts(with searchTerm: String, onPage page: Int)
func updateProductFavorited(_ product: Product, to newValue: Bool)
}
protocol MainSearchInteractorOutput: class {
func onFetchProductsSuccess(_ products: [Product]?, shouldAppend: Bool)
func onFetchProductsFailure(message: String)
}
protocol MainSearchWireframe: class {
func showProductScreen(delegate: ProductScreenDelegate, product: Product?)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment