// // ModelExtension.swift // GMERemittance // // Created by Sujal on 12/26/17. // Copyright © 2017 Gobal Money Express Co. Ltd. All rights reserved. // import Foundation class ModelExtension { var errorMessage: String? var internetConnection: Box = Box(nil) var anotherLogin: Box = Box(nil) func setErrorMessage(message: String) { errorMessage = message } func getErrorMessage() -> String { if errorMessage != nil { return errorMessage! } else { return "Connection timeout. Please try again." } } func getUserId() -> String { if let userId = UserDefaults.standard.object(forKey: "com.gmeremit.username") as? String { return userId } else { return "" } } func getLoginPassword() -> String { if let passwordBase64 = UserDefaults.standard.object(forKey: "com.gmeremit.password") as? String{ let decodedData = Data(base64Encoded: passwordBase64)! let password = String(data: decodedData, encoding: .utf8)! return password } else { return "" } } }