私はこのコードでレルムエントリを作成していますが、正常に動作します。作成したレルムエントリの値を取得する方法は?
let new = Exercises()
new.name = new_name
new.notes = new_notes
try! RealmDB.write({() -> Void in
self.selectedDate.exercises.append(new)
})
入力がrealmデータベースで作成されると、いくつかのuitextfieldsをそのエントリの値で更新する必要があります。
NameField.text = String(XXXXX.name)
NotesField.text = String(XXXXX.notes)
私はちょうどそのXXXXXのためのコードの右の部分を見つけることができません。あなたはいくつかのアイデアがあれば教えてください。
単純化された領域構造は、このようになります。あなたのself.selectedDate
オブジェクトがあなたのUITextField
オブジェと同じスコープ内にある場合、それは単にの問題であるべき
Dates {
date {
type = date;
objectClassName = (null);
indexed = NO;
isPrimary = NO;
optional = NO;
}
exercises {
type = array;
objectClassName = Exercises;
indexed = NO;
isPrimary = NO;
optional = NO;
}
}
Exercises {
date {
type = date;
objectClassName = (null);
indexed = NO;
isPrimary = NO;
optional = NO;
}
name {
type = string;
objectClassName = (null);
indexed = NO;
isPrimary = NO;
optional = NO;
}
notes {
type = string;
objectClassName = (null);
indexed = NO;
isPrimary = NO;
optional = NO;
}
}
ありがとうございます!あなたは私の一日を作った! self.selectedDate.exercises.lastは私のために仕事をしました。 – alexey
ああ!驚くばかり!どういたしまして!すべての幸運! :) – TiM