In my RealmSwift (0.92.3) in Xcode6.3, how would I
// the Realm Object Definition import RealmSwift class NameEntry: Object { dynamic var player = "" dynamic var gameCompleted = false dynamic var nrOfFinishedGames = 0 dynamic var date = NSDate() }
The current View table finds the number of objects (i.e. currently all objects), for example:
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { if let cnt = RLM_array?.objects(NameEntry).count { return Int(cnt) } else { return 0 } }
First question: how do I find the number of objects that have a date record after, say, the date 06/15/2014 ?? (i.e. a date request is above a certain date from RealmSwift-Object - how does it work?). Or, in other words, how would the method described above find the number of objects with the required date range?
Successfully populating all Realm objects in a tableView is as follows:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { var cell = tableView.dequeueReusableCellWithIdentifier("NameCell") as! PlayersCustomTableViewCell if let arry = RLM_array { let entry = arry.objects(NameEntry)[indexPath.row] as NameEntry cell.playerLabel.text = entry.player cell.accessoryType = entry.gameCompleted ? .None : .None return cell } else { cell.textLabel!.text = "" cell.accessoryType = .None return cell } }
The second question: how can I fill out the table? View only RealmSwift objects that have a specific date (for example, filling only those objects that have a date above 06/15/2014). Or, in other words, how would the above method only populate the View table of objects with the required date range?
source share