@@ -77,7 +77,7 @@ class TableRowModel: SPDiffableItem {}
77
77
After it add properties, which you want use. For example:
78
78
79
79
``` swift
80
- class TableRowMode : SPDiffableItem {
80
+ class TableRowModel : SPDiffableItem {
81
81
82
82
public var text: String
83
83
public var detail: String ? = nil
@@ -95,13 +95,13 @@ override func viewDidLoad() {
95
95
super .viewDidLoad ()
96
96
97
97
// Register cell for usage it in table view
98
- tableView.register (NativeTableViewCell .self , forCellReuseIdentifier : NativeTableViewCell. identifier )
98
+ tableView.register (SPDiffableTableViewCell .self , forCellReuseIdentifier : SPDiffableTableViewCell. reuseIdentifier )
99
99
100
- // Cell provider for `TableRowMode `
100
+ // Cell provider for `TableRowModel `
101
101
let cellProvider: SPDiffableTableCellProvider = { (tableView, indexPath, model) -> UITableViewCell? in
102
102
switch model {
103
- case let model as TableRowMode :
104
- let cell = tableView.dequeueReusableCell (withIdentifier : NativeTableViewCell .identifier , for : indexPath) as! NativeTableViewCell
103
+ case let model as TableRowModel :
104
+ let cell = tableView.dequeueReusableCell (withIdentifier : YourTableViewCell .identifier , for : indexPath) as! YourTableViewCell
105
105
cell.textLabel ? .text = model.text
106
106
cell.detailTextLabel ? .text = model.detail
107
107
cell.accessoryType = model.accessoryType
@@ -117,7 +117,7 @@ override func viewDidLoad() {
117
117
setCellProviders ([cellProvider], sections : content)
118
118
}
119
119
```
120
-
120
+ You can use default cell provider if using project's models. For get it call ` SPDiffableTableController.defaultCellProvider ` .
121
121
All actions similar to collections. For example usage you can find in project in taget ` Example ` .
122
122
123
123
### Apply Content
@@ -131,7 +131,7 @@ let section = SPDiffableSection(
131
131
header : SPDiffableTextHeaderFooter (text : " Header" ),
132
132
footer : SPDiffableTextHeaderFooter (text : " Footer" ),
133
133
items : [
134
- TableRowMode (text : " Basic Table Cell" , accessoryType : .disclosureIndicator , action : { [weak self ] indexPath in
134
+ TableRowModel (text : " Basic Table Cell" , accessoryType : .disclosureIndicator , action : { [weak self ] indexPath in
135
135
guard let self = self else { return }
136
136
self .tableView .deselectRow (at : indexPath, animated : true )
137
137
print (" Tapped" )
@@ -221,10 +221,14 @@ Now in project you can find this ready-use models:
221
221
#### For Table:
222
222
223
223
- ` SPDiffableTableRow ` it native item for table cell. Support all basic styles and action for tap event.
224
+ - ` SPDiffableTableRowSubtitle ` it native item for table cell with subtitle. Support all as before.
224
225
- ` SPDiffableTableRowStepper ` item for table cell with stepper. Has maximum value and minimum, also incuded action with passed value.
225
226
- ` SPDiffableTableRowSwitch ` item for table with switch, included default state and action for change event.
226
227
- ` SPDiffableTableRowButton ` item for table in style as button. Support table styles and action for tap.
227
228
229
+ - ` SPDiffableTableViewCell ` basic table cell with detail text right side.
230
+ - ` SPDiffableSubtitleTableViewCell ` basic table cell with two lines of texts.
231
+
228
232
#### For Collection:
229
233
230
234
Now in progress development.
0 commit comments