Created
June 13, 2017 06:01
-
-
Save yoonjason/43d7bc20d6da365074d28dfab618665b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//로컬 JsonString 데이터 바인딩을 위해서 만들어놓은 Mapper | |
class PatientInfodata: ImmutableMappable { | |
var fullname : String | |
var lastname : String | |
var birthday : String | |
var mobile : String | |
var email : String | |
var gender : String | |
var statusCd : String | |
var insuranceData : Array<AfterSignInInsuranceData> | |
required init(map: Map) throws { | |
fullname = try map.value("fullname") | |
lastname = try map.value("lastname") | |
birthday = try map.value("birthday") | |
mobile = try map.value("mobile") | |
email = try map.value("email") | |
gender = try map.value("gender") | |
statusCd = try map.value("statusCd") | |
insuranceData = try map.value("insurance") | |
} | |
} | |
class AfterSignInInsuranceData: ImmutableMappable { | |
var code : String | |
var name : String | |
required init(map: Map) throws { | |
code = try map.value("code") | |
name = try map.value("name") | |
} | |
} | |
//LocalInfo | |
class LocalInfo: NSObject { | |
var patientData : PatientInfodata! | |
} | |
//UIView base | |
class BaseViewController { | |
var localInfo = LocalInfo() | |
} | |
class FirsstViewController : BaseViewController { | |
//암호화된 jsonString을 복호화한 것. | |
let userDataJsonString = AES256CBC.decryptString(data, key32: descryptionKey, iv16: descryptionIv) | |
//userDataJsonString을 가지고, 위의 patientInfoData에 매핑 | |
do { | |
let pData = try Mapper<PatientInfodata>().map(JSONString: userDataJsonString!) | |
localInfo.patientData = pData | |
//print(localInfo.patientData.moblie)시 정확한 값 출력 | |
self.perform~ //SecondViewController로 이동. | |
}catch { | |
print(error) | |
} | |
} | |
//LocalInfo를 상속받은 ViewController | |
class SecondViewController : BaseViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Print 출력이 되지않음.. | |
if let ppData = localInfo.patientData { | |
print(ppData.gender) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment