| 测试已测试 | ✗ |
| 语言语言 | Obj-CObjective C |
| 许可证 | MIT |
| 发布最新发布 | 2016年5月 |
由 Adam Fish 维护。
| 依赖项 | |
| RBQFetchedResultsController | >= 4.0.3 |
| Realm | >= 0.103.0 |
ABFRealmTableViewController 类是 UITableViewController 的子类,但它为 Realm 对象类添加了数据绑定。底层的 UITableView 将通过使用 RBQFetchedResultsController 来动画化变化。
在 v1.1 版中添加了一个 Swift 版本,具有相同的 API。
要使用,只需像使用 UITableViewController 一样从 ABFRealmTableViewController 继承,并将 entityName 属性设置为 Realm 对象类的名称。类似于 UITableView 实现的方式,您需要实现必要的 UITableViewControllerDelegate 和 UITableViewControllerDataSource 协议。
从 v1.5 开始,底层由 RBQFetchedResultsController 提供的数据绑定不需要使用自定义 Realm 变更方法,因为 Realm 支持直接使用细粒度的通知。因此,您可以直接与普通的 Realm 方法一起使用 ABFRealmTableViewController。
示例应用是一个具有对象模型的基本待办事项列表:与 UITableView 绑定的 TaskObject。当创建新的 TaskObject 时,行将动画进入,当删除 TaskObject 时,行将动画退出。
ABFRealmTableViewController 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
Objective-C
pod 'ABFRealmTableViewController'
Swift
pod 'RealmTableViewController'
在 Xcode 中创建并运行/测试示例项目以查看 ABFRealmTableViewController 的实际应用。此项目使用 CocoaPods。如果您还没有安装 CocoaPods,请使用以下命令安装:[sudo] gem install cocoapods。
Objective-C
git clone https://github.com/bigfish24/ABFRealmTableViewController.git
cd ABFRealmTableViewController/ABFRealmTableViewControllerExample
pod install
open ABFRealmTableViewController.xcworkspace
Swift
git clone https://github.com/bigfish24/ABFRealmMapView.git
cd ABFRealmTableViewController/SwiftExample
pod install
open RealmTableViewController.xcworkspace