mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-30 04:28:44 +00:00
FetchedRecordsController.recordAtIndexPath returns a non-optional (as NSFetchedResultsController does)
This commit is contained in:
1 parent
d0c5e98366
commit
c4c0e67407
2 files changed
+4
-7
No files matched your search
@@ -143,13 +143,13 @@ class MasterViewController: UITableViewController {
|
||||
}
|
||||
|
||||
private func configureCell(cell: UITableViewCell, atIndexPath indexPath:NSIndexPath) {
|
||||
let person = fetchedRecordsController.recordAtIndexPath(indexPath)!
|
||||
let person = fetchedRecordsController.recordAtIndexPath(indexPath)
|
||||
cell.textLabel!.text = "\(person.position) - \(person.fullName)"
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
|
||||
// Delete the person
|
||||
let person = fetchedRecordsController.recordAtIndexPath(indexPath)!
|
||||
let person = fetchedRecordsController.recordAtIndexPath(indexPath)
|
||||
try! person.delete(dbQueue)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,12 +111,9 @@ public class FetchedRecordsController<T: RowConvertible> {
|
||||
|
||||
|
||||
/// Returns the fetched record at a given indexPath.
|
||||
public func recordAtIndexPath(indexPath: NSIndexPath) -> T? {
|
||||
public func recordAtIndexPath(indexPath: NSIndexPath) -> T {
|
||||
precondition(NSThread.isMainThread(), "Must be called on the main thread")
|
||||
if let item = self.mainItems?[indexPath.indexAtPosition(1)] {
|
||||
return item.record
|
||||
}
|
||||
return nil
|
||||
return self.mainItems![indexPath.indexAtPosition(1)].record
|
||||
}
|
||||
|
||||
/// Returns the indexPath of a given record.
|
||||
|
||||
Reference in new issue
Block a user