I made ToDo according to the tutorial on the page above, but in the code below, return realm.objects(ToDo)
,
Expected member name or constructor call after type name
You will see the error
I was able to resolve the other error, but I couldn't erase the error in this part.
Could you tell me how to solve this problem?
source code
import UIKit
import RealmSwift
classViewController:UIViewController {
@IBOutlet var todoNameText:UITextField!
@IBOutlet variableView:UITableView!
var toDoItems:Results<ToDo>?{
do{
let realm = try Realm()
return realm.objects (ToDo)
}catch {
print("Error")
}
return nil
}
Pass the class object (meta type) to the Realm.objects(_:)
parameter.
Swift grammar requires .self
after ToDo.self
and ToDo
.self to obtain the meta-type.
© 2024 OneMinuteCode. All rights reserved.