0
My intention is to filter a single line within the previous filter results, but returning the same type, so I can perform a third filter.
This is my attempt:
func salvarDadosAluno(_codPessoa: String, _codCurso: String){
let realm = try! Realm()
let aluno = realm.objects(Alunos.self).filter("codPessoa == %@", _codPessoa).first
//Cannot convert value of type 'Alunos' to expected 'Object.type'
let curso = realm.objects(aluno).filter("codCurso == %@", _codCurso).first
print(cursos)
}
Here is my DB:
class Alunos : Object{
dynamic var codPessoa: String = ""
dynamic var raPessoa: String = ""
dynamic var nomePessoa: String = ""
let cursos = List<Cursos>()
}
class Cursos : Object{
dynamic var codCurso: String = ""
dynamic var desCurso: String = ""
let disciplinas = List<Disciplinas>()
}
And with the result of these searches, I want to insert more disciplines for this student, in this filtered course, like this:
try! realm.write {
curso?.disciplinas.append(curso)
}
How to proceed?
I appreciate any help