I have a class and inside a subclass
import Foundation
import ObjectMapper
class Aluno: Mappable
{
var ra:String!
var senha:String!
var nome:String!
var cpf:String!
var email:String!
var matricula:Matricula!
required init?(_ map: Map) {}
func mapping(map: Map) {
ra <- map["Ra"]
senha <- map["Senha"]
nome <- map["Nome"]
cpf <- map["Cpf"]
email <- map["Email"]
matricula <- map["Matricula"]
}
}
import Foundation
import ObjectMapper
class Matricula: Mappable
{
var turma:String!
var turno:String!
var curriculo:String!
var curso:Curso!
var instituicao:Instituicao!
required init?(_ map: Map) {}
func mapping(map: Map) {
turma <- map["Turma"]
turno <- map["Turno"]
curriculo <- map["Curriculo"]
curso <- map["Curso"]
instituicao <- map["Instituicao"]
}
}
After filling this object with a return from a JSON
Alamofire.request(.GET, urlBase, parameters: ["ra": idDoAluno, "senha": senhaDoAluno])
.responseJSON { response in
let JSON = response.result.value as! NSDictionary;
self.aluno = Mapper<Aluno>().map(JSON["Dados"]!)!
How do I save this Student object within a session (NSUserDefaults) to retrieve it in another view?