Моя имлементация builder выглядела следующим образом:
import UIKit
class AnyCellBuilder<C> where C: UITableViewCell {
typealias Cell = C
var tableView: UITableView!
var indexPath: IndexPath!
| import RealmSwift | |
| class MarketGroup: Object { | |
| dynamic var marketGroupID: Int = -1 | |
| dynamic var parentGroup: MarketGroup? = nil | |
| dynamic var marketGroupName: String = "" | |
| dynamic var groupDescription: String = "" | |
| dynamic var hasTypes: Bool = false | |
| var iconID: RealmOptional<Int> = RealmOptional(nil) | |
Моя имлементация builder выглядела следующим образом:
import UIKit
class AnyCellBuilder<C> where C: UITableViewCell {
typealias Cell = C
var tableView: UITableView!
var indexPath: IndexPath!
| import UIKit | |
| protocol ItemViewBinder { | |
| func bind(model: Item,to view: ItemViewType) | |
| } | |
| extension ItemViewBinder { | |
| func bind(model: Item,to view: ItemViewType) { | |
Вот как выглядит SOA и MVPVM в моем последнем приложении (это экран который отображает магазины на google картах):
StoresTarget (Транспортный слой построен на Moya):
extension TargetType {
var baseURL: URL { return URL(string: "https://my-api-base-url")! }
var parameterEncoding: ParameterEncoding { return JSONEncoding() }
StoresViewController:
class StoresViewController: BasicViewController, RouterType {
@IBOutlet weak var tableView: UITableView!
let presentationModel: StoresPresentationModel = StoresPresentationModel()
let storesSectionSubject: BehaviorSubject<[StoreViewModel]> = BehaviorSubject(value: [])
| //: Playground - noun: a place where people can play | |
| import PlaygroundSupport | |
| import Foundation | |
| import RealmSwift | |
| import RxSwift | |
| PlaygroundPage.current.needsIndefiniteExecution = true | |
| class RealmString: Object { |
| import UIKit | |
| import PlaygroundSupport | |
| PlaygroundPage.current.needsIndefiniteExecution = true | |
| class ObjcClass: NSObject { | |
| func thisMethodWillBeEnqueuedToRunLoop() { | |
| print("I am executed") | |
| } |
| final class MoreItems: BasicCollection<Item> { | |
| init(for viewController: UIViewController) { | |
| let items: [Item] = [ | |
| BasicItem( | |
| image: #imageLiteral(resourceName: "ImageProfilePlaceholder"), | |
| title: "Профиль", | |
| description: "", | |
| command: CommandToPerform{ [weak viewController] in | |
| viewController?.navigationController?.pushViewController(Storyboard.More.profileViewController(), animated: true) | |
| }), |
| //: Playground - noun: a place where people can play | |
| import UIKit | |
| @testable import Web3Swift | |
| print( | |
| try Keccak256Bytes( | |
| origin: EthContractCreationBytes( | |
| networkID: BigEndianCompactNumber( | |
| hex: "0x2a" |
| /** | |
| { | |
| "exchangeContractAddress" : "0x12459c951127e0c374ff9105dda097662a027093", | |
| "maker" : "0x8c7d76d9aef6a104b500cfd1746c331f4da5bce8", | |
| "taker" : "0x0000000000000000000000000000000000000000", | |
| "makerTokenAddress" : "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", | |
| "takerTokenAddress" : "0xe41d2489571d322189246dafa5ebde1f4699f498", | |
| "feeRecipient" : "0xa258b39954cef5cb142fd567a46cddb31a670124", | |
| "makerTokenAmount" : "1950100000000000", |