Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Commit

Permalink
Improve README
Browse files Browse the repository at this point in the history
  • Loading branch information
3lvis committed Feb 10, 2017
1 parent 0b34471 commit afd46be
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,22 @@ Hooking up your table view to your `Task` model and making your UITableView reac

**Swift:**
```swift
let request: NSFetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "Task")
request.sortDescriptors = [NSSortDescriptor(key: "title", ascending: true)]
lazy var dataSource: DATASource = {
let request: NSFetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "Task")
request.sortDescriptors = [NSSortDescriptor(key: "title", ascending: true)]

let dataSource = DATASource(tableView: self.tableView, cellIdentifier: "Cell", fetchRequest: request, mainContext: self.dataStack.mainContext, configuration: { cell, item, indexPath in
cell.textLabel?.text = item.valueForKey("title") as? String
})
let dataSource = DATASource(tableView: self.tableView, cellIdentifier: "Cell", fetchRequest: request, mainContext: self.dataStack.mainContext, configuration: { cell, item, indexPath in
cell.textLabel?.text = item.valueForKey("title") as? String
})

tableView.dataSource = dataSource
return dataSource
}()

override func viewDidLoad() {
super.viewDidLoad()

self.tableView.dataSource = self.dataSource
}
```

**Objective-C:**
Expand Down

0 comments on commit afd46be

Please sign in to comment.