You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
footer:SPDiffableTextFooter(text:"Also you can add more providers for specific controller, and use default and custom specially for some contorllers."),
84
+
footer:SPDiffableTextHeaderFooter(text:"Also you can add more providers for specific controller, and use default and custom specially for some contorllers."),
79
85
items:[
80
86
SPDiffableTableRow(text:"Custom Cell Provider", accessoryType:.disclosureIndicator, action:{[weak self] indexPath in
Copy file name to clipboardExpand all lines: Readme.md
+68-33Lines changed: 68 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,13 @@
1
1
# SPDiffable
2
2
3
-
Apple's diffable API requerid models for each object type. If you want use it in many place, you pass many time to implemenet and get over duplicates codes. This project help you do it elegant with shared models and special cell providers for one-usage models.
3
+
Apple's diffable API requerid models for each object type. If you want use it in many place, you pass many time to implemenet and get over duplicates codes. This project help you do it elegant with shared models and special cell providers for one-usage models.
4
4
5
5
If you like the project, don't forget to `put star ★` and follow me on GitHub:
If you want help project, check [Сooperation](#сooperation) section.
10
+
9
11
## Navigate
10
12
11
13
-[Requirements](#requirements)
@@ -17,8 +19,9 @@ If you like the project, don't forget to `put star ★` and follow me on GitHub:
17
19
-[Usage](#usage)
18
20
-[How it work](#usage)
19
21
-[Apply content](#apply-content)
20
-
-[Ready Use Models](#ready-use-models)
21
22
-[Mediator](#mediator)
23
+
-[Sidebar](#sidebar)
24
+
-[Ready Use Models](#ready-use-models)
22
25
-[Сooperation](#сooperation)
23
26
-[Other Projects](#other-projects)
24
27
-[Russian Community](#russian-community)
@@ -63,15 +66,15 @@ If you prefer not to use any of dependency managers, you can integrate `SPDiffab
63
66
64
67
Before read it, highly recomded check `Example` target in project. It examle show all features, like use stepper and switch, like process actions, create custom models and many other.
65
68
66
-
For work with diffable need create model (inside project you found some ready-use models) and do cell provider, which convert model with data to `UITableViewCell` or `UICollectionViewCell`.
69
+
For work with diffable need create model (inside project you found some ready-use models) and do cell provider, which convert model with data to `UITableViewCell` or `UICollectionViewCell`. Next example for table, but all methods and class names available for collections.
67
70
68
71
New model shoud extend from basic class `SPDiffableItem`:
69
72
70
73
```swift
71
74
classTableRowModel: SPDiffableItem {}
72
75
```
73
76
74
-
After it add properties, which you want use:
77
+
After it add properties, which you want use. For example:
75
78
76
79
```swift
77
80
classTableRowMode: SPDiffableItem {
@@ -84,7 +87,7 @@ class TableRowMode: SPDiffableItem {
84
87
}
85
88
```
86
89
87
-
Last step, create table controller class and extend of `SPDiffableTableController`. Create custom cell provider, it help convert it data to table cell:
90
+
Last step, create table controller class and extend of `SPDiffableTableController`. Create custom cell provider, it doing convert it data to table cell:
88
91
89
92
```swift
90
93
@@ -115,7 +118,7 @@ override func viewDidLoad() {
115
118
}
116
119
```
117
120
118
-
For example usage you can find in project in taget `Example`.
121
+
All actions similar to collections. For example usage you can find in project in taget `Example`.
That all. You can each time create new order or count cells and it automatically show with diffable animation. Project has some ready-use models, you can read about it next.
149
152
150
-
### Ready Use Models
151
-
152
-
It models which you can use now, it shoud close your task without code. Of couse you can create your models.
153
-
Now in project you can find this ready-use models:
154
-
155
-
-`SPDiffableItem` it basic class. All item models shoud be extend from it model.
156
-
-`SPDiffableSection` basic section class. Included footer and header, also items (cells).
157
-
-`SPDiffableHeader` basic header class. All headers shoud be extend from it class.
158
-
-`SPDiffableFooter` basic footer class. All footers shoud be extend from it class.
159
-
160
-
#### For Table:
161
-
162
-
-`SPDiffableTableRow` it native table view cell. Support all basic styles and action for tap event.
163
-
-`SPDiffableTableRowStepper` table view cell with stepper. Has maximum value and minimum, also incuded action with passed value.
164
-
-`SPDiffableTableRowSwitch` table cell with switch, included default state and action for change event.
165
-
-`SPDiffableTableRowButton` table cell with style as button. Supprt table styles and action for tap.
166
-
-`SPDiffableTableTextHeader` table header with text. You can see it in native table.
167
-
-`SPDiffableTableTextFooter` table footer text.
168
-
169
-
#### For Collection:
170
-
171
-
Now in progress development.
172
-
173
153
### Mediator
174
154
175
155
Some methods in diffable data source can't ovveride without custom data source. It solved with mediator delegate. It simple. Next example for table. Set delegate `SPTableDiffableMediator`, all method optional:
Content it array of `SPDiffableSection`. For menu model need use model `SPDiffableSideBarMenuItem`. For header and footer will create `SPDiffableSideBarHeader` model.
It models which you can use now, it shoud close your task without code. Of couse you can create your models.
213
+
Now in project you can find this ready-use models:
214
+
215
+
-`SPDiffableItem` it basic class. All item models shoud be extend from it model. Header and footer also.
216
+
-`SPDiffableSection` section class. Included footer and header properties, also items (cells).
217
+
-`SPDiffableTextHeaderFooter` header or footer class with text.
218
+
219
+
#### For Table:
220
+
221
+
-`SPDiffableTableRow` it native item for table cell. Support all basic styles and action for tap event.
222
+
-`SPDiffableTableRowStepper` item for table cell with stepper. Has maximum value and minimum, also incuded action with passed value.
223
+
-`SPDiffableTableRowSwitch` item for table with switch, included default state and action for change event.
224
+
-`SPDiffableTableRowButton` item for table in style as button. Support table styles and action for tap.
225
+
226
+
#### For Collection:
227
+
228
+
Now in progress development.
229
+
230
+
-`SPDiffableSideBarMenuItem` menu item in side bar. Support accessories and actions.
231
+
-`SPDiffableSideBarHeader` header model for side bar item.
232
+
198
233
## Сooperation
199
234
200
235
This project is free, but developing it takes time. Contributing to this project is a huge help. Here is list of tasks that need to be done, you can help with any:
0 commit comments