// ICardSubscriptionService.swift
protocol ICardSubscriptionService: class {
func getSubscriptionPlans() -> [SubscriptionPlan]
func orderCard(
planUID: UUID,
addressLine1: String,
addressLine2: String?,
countryCode: String,
city: String,
postCode: String,
cardPin: String,
personalisedIban: String?) -> Bool
func activateCard(lastDigits: String) -> Bool
func getCards() -> Observable<[MoneybaseCard]>
func reportCard() -> Bool
func unfreezeCard() -> Bool
func deleteCard() -> Bool
func getPinCard(cardUID: UUID) -> String
func linkCard(cardNumber: String) -> Bool
}
// MainAssembly.swift
...
container.register(ICardSubscriptionService.self) { r in
return CardSubscriptionServiceStub()
}.inObjectScope(.container)
...
// CardSecurityViewController.swift
override func viewDidLoad() {
super.viewDidLoad()
cardService = self.assembler?.resolver.resolve(ICardSubscriptionService.self)
cardService?.getCards().subscribe { [weak self] event in
switch event {
case .next(let value):
print("====NEXT")
self?.cardSecurities = value[0].cardSecurities
self?.collectionView.reloadData()
case .error(let error):
print("====Error")
print(error)
case .completed:
print("====Compltede")
print("completed")
}
}.disposed(by: _disposeBag)
}