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
Copy file name to clipboardExpand all lines: Readme.md
+58-31Lines changed: 58 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,9 @@ If you want help project, check [Сooperation](#сooperation) section.
21
21
-[Apply content](#apply-content)
22
22
-[Mediator](#mediator)
23
23
-[Sidebar](#sidebar)
24
-
-[Ready Use Models](#ready-use-models)
24
+
-[Ready Use](#ready-use)
25
+
-[Example](#ready-use)
26
+
-[Ready-use models](#ready-use-models)
25
27
-[Сooperation](#сooperation)
26
28
-[Other Projects](#other-projects)
27
29
-[Russian Community](#russian-community)
@@ -64,26 +66,23 @@ If you prefer not to use any of dependency managers, you can integrate `SPDiffab
64
66
65
67
## Usage
66
68
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.
69
+
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. Also you can skip full undestand logic and read [Ready-use section](#Ready Use) with minimum of code for start.
68
70
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.
71
+
For work with diffable need create model (inside project you found some ready-use models) and do cell provider, which convert data-model to `UITableViewCell` or `UICollectionViewCell`. Next example for table, but all methods and class names available for collections.
70
72
71
73
New model shoud extend from basic class `SPDiffableItem`:
72
74
73
75
```swift
74
-
classTableRowModel: SPDiffableItem {}
76
+
classLocationRowModel: SPDiffableItem {}
75
77
```
76
78
77
79
After it add properties, which you want use. For example:
You can use default cell provider if using project's models. For get it call `SPDiffableTableController.defaultCellProvider`.
121
-
All actions similar to collections. For example usage you can find in project in taget `Example`.
117
+
In project available models for like `SPDiffableTableRow` and other with ready-use properties. Also you can use default cell provider if using project's models. For get it call `SPDiffableTableController.defaultCellProvider`.
122
118
123
119
### Apply Content
124
120
@@ -131,11 +127,9 @@ let section = SPDiffableSection(
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.
145
+
That all. You can each time create new order or count cells and it automatically show with diffable animation.
152
146
153
147
### Mediator
154
148
@@ -177,7 +171,7 @@ In protocol you can find more methods, like `canEdit` and other.
177
171
178
172
### Sidebar
179
173
180
-
Create new controller and extend from `SPDiffableSideBarController`. Remember, it available only from iOS 14. Now it abailable for `ios14` branch.
174
+
Create new controller and extend from `SPDiffableSideBarController`. Remember, it available only from iOS 14.
You can save time and count of code using ready-use classes. In project available models and views. For example you need simple table with native cells. You need create content with `SPDiffableTableRow`:
You init cell model and pass action, choose selection style and other. As you see, model describe native table cell. Next, you need set cell provider, but it also already available, for get it call `SPDiffableTableController.defaultCellProvider`.
0 commit comments