You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
// // EditReciepientInteractor.swift // GMERemittance // // Created by gme_2 on 28/08/2018. //Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. //
import Foundation
class EditReciepientInteractor { // MARK: Properties weak var output: EditReciepientInteractorOutput? private let service: EditReciepientServiceType var reciepient: Recipient // MARK: Initialization init(service: EditReciepientServiceType, reciepient: Recipient) { self.service = service self.reciepient = reciepient }
// MARK: Converting entities }
// MARK: EditReciepient interactor input interface
extension EditReciepientInteractor: EditReciepientInteractorInput { func viewIsReady() { self.service.fetch(success: { (model) in self.output?.show(model: model) self.output?.show(recipient: self.reciepient) }) { (error) in self.output?.show(error: error) } } func save(reciepient: Recipient) { let defaults = UserDefaults.standard let myUsername = defaults.string(forKey: "com.gmeremit.username") ?? "" self.service.save(model: reciepient.serialize(), username: myUsername, success: { (reciepient) in self.output?.success() }) { (error) in self.output?.show(error: error) } } }
|