Skip to content

Commit c926da8

Browse files
committed
Updated to 2.0
1 parent 54af741 commit c926da8

28 files changed

+119
-145
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+4-16
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,10 @@ labels: bug
66
assignees: ivanvorobei
77
---
88

9-
**Describe the bug**
10-
A clear and concise description of what the bug is.
11-
12-
**To Reproduce**
13-
Steps to reproduce the behavior:
14-
15-
**Expected behavior**
16-
A clear and concise description of what you expected to happen.
17-
18-
**Screenshots**
19-
If applicable, add screenshots to help explain your problem.
20-
21-
**Smartphone (please complete the following information):**
9+
**Summary**
2210
- iOS Version [e.g. 14.5.1]
2311
- Framework Version [e.g. 3.0.8]
2412
- Installed via [e.g. SPM, Cocoapods, Manually]
25-
26-
**Additional context**
27-
Add any other context about the problem here.
13+
14+
**Describe the bug**
15+
A clear and concise description of what the bug is.

.github/ISSUE_TEMPLATE/feature_request.md

-6
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,3 @@ A clear and concise description of what the problem is. Ex. I'm always frustrate
1212

1313
**Describe the solution you'd like**
1414
A clear and concise description of what you want to happen.
15-
16-
**Describe alternatives you've considered**
17-
A clear and concise description of any alternative solutions or features you've considered.
18-
19-
**Additional context**
20-
Add any other context or screenshots about the feature request here.

.github/ISSUE_TEMPLATE/question.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Question
33
about: Something is not clear with the project
44
title: ''
5-
labels: ''
5+
labels: 'question'
66
assignees: ivanvorobei
77

88
---

.github/PULL_REQUEST_TEMPLATE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
## Checklist
55
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
6-
- [ ] Testing in compability platforms
7-
- [ ] Installed correct via Swift Package Manager and Cocoapods
6+
- [] Testing in compability platforms
7+
- [] Installed correct via `Swift Package Manager` and `Cocoapods`

CONTRIBUTING.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ Here you find all which using in project:
2323
- // MARK: - Init
2424
- // MARK: - Lifecycle
2525
- // MARK: - Layout
26-
- // MARK: - Helpers
26+
- // MARK: - Public
27+
- // MARK: - Private
28+
- // MARK: - Internal
29+
- // MARK: - Models
30+
- // MARK: - Ovveride
2731

2832
If you can't find valid, add new to codestyle agreements please. Other can be use if class is large and need struct it even without adding to codestyle agreements.

Example Apps/iOS Example/Controllers/RootController.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class RootController: DiffableTableController {
3838
case checkmark = "checkmark"
3939
case customCellProvider = "customCellProvider"
4040

41-
var identifier: String {
41+
var id: String {
4242
return rawValue
4343
}
4444
}
@@ -48,7 +48,7 @@ class RootController: DiffableTableController {
4848
var content: [SPDiffableSection] = []
4949

5050
let accessorySection = SPDiffableSection(
51-
identifier: Section.accessory.identifier,
51+
id: Section.accessory.id,
5252
header: SPDiffableTextHeaderFooter(text: "Accessory"),
5353
footer: SPDiffableTextHeaderFooter(text: "Getting default value before show. After changes in elements you can check prints in console."),
5454
items: [
@@ -66,7 +66,7 @@ class RootController: DiffableTableController {
6666
content.append(accessorySection)
6767

6868
let basicSection = SPDiffableSection(
69-
identifier: Section.basic.identifier,
69+
id: Section.basic.id,
7070
header: SPDiffableTextHeaderFooter(text: "Presenter"),
7171
footer: SPDiffableTextHeaderFooter(text: "Push in navigation processing by table controller. Sometimes you need manually deselect cell."),
7272
items: [
@@ -90,13 +90,13 @@ class RootController: DiffableTableController {
9090

9191
if stepperValue != 0 {
9292
accessorySection.items.append(
93-
SPDiffableTableRow(identifier: stepperValueIdentifier, text: "Stepper Value", detail: "\(Int(stepperValue))")
93+
SPDiffableTableRow(id: stepperValueIdentifier, text: "Stepper Value", detail: "\(Int(stepperValue))")
9494
)
9595
}
9696

9797
if #available(iOS 14, *) {
9898
let sideBarSections = SPDiffableSection(
99-
identifier: Section.sidebar.identifier,
99+
id: Section.sidebar.id,
100100
footer: SPDiffableTextHeaderFooter(text: "Example of new Side Bar."),
101101
items: [
102102
SPDiffableTableRow(text: "Present Side Bar", accessoryType: .disclosureIndicator, selectionStyle: .default, action: { [weak self] model, indexPath in
@@ -112,7 +112,7 @@ class RootController: DiffableTableController {
112112
}
113113

114114
let checkmarkSections = SPDiffableSection(
115-
identifier: Section.checkmark.identifier,
115+
id: Section.checkmark.id,
116116
footer: SPDiffableTextHeaderFooter(text: "Example how usage search by models and change checkmark without reload table."),
117117
items: [
118118
SPDiffableTableRow(text: "Chekmarks", accessoryType: .disclosureIndicator, selectionStyle: .default, action: { [weak self] model, indexPath in
@@ -124,7 +124,7 @@ class RootController: DiffableTableController {
124124
content.append(checkmarkSections)
125125

126126
let cellProviderSection = SPDiffableSection(
127-
identifier: Section.customCellProvider.identifier,
127+
id: Section.customCellProvider.id,
128128
footer: SPDiffableTextHeaderFooter(text: "Also you can add more providers for specific controller, and use default and custom specially for some contorllers."),
129129
items: [
130130
SPDiffableTableRow(text: "Custom Cell Provider", accessoryType: .disclosureIndicator, selectionStyle: .default, action: { [weak self] model, indexPath in

Example Apps/iOS Example/Controllers/SideBarController.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class SidebarController: SPDiffableSideBarController {
4141
var content: [SPDiffableSection] = []
4242
content.append(
4343
SPDiffableSection(
44-
identifier: Section.tabs.rawValue,
44+
id: Section.tabs.rawValue,
4545
items: [
4646
SPDiffableSideBarItem(title: "Listen Now", image: UIImage(systemName: "play.circle"), action: { _, _ in }),
4747
SPDiffableSideBarItem(title: "Browse", image: UIImage(systemName: "square.grid.2x2"), action: { _, _ in }),
@@ -60,7 +60,7 @@ class SidebarController: SPDiffableSideBarController {
6060
)
6161
content.append(
6262
SPDiffableSection(
63-
identifier: Section.library.rawValue,
63+
id: Section.library.rawValue,
6464
header: SPDiffableSideBarHeader(text: "Library", accessories: [.outlineDisclosure()]),
6565
items: [
6666
SPDiffableSideBarItem(title: "Recently Added", image: UIImage(systemName: "clock"), action: { _, _ in }),
@@ -73,7 +73,7 @@ class SidebarController: SPDiffableSideBarController {
7373
)
7474
content.append(
7575
SPDiffableSection(
76-
identifier: Section.playlists.rawValue,
76+
id: Section.playlists.rawValue,
7777
header: SPDiffableSideBarHeader(text: "Playlists", accessories: [.outlineDisclosure()]),
7878
items: [
7979
SPDiffableSideBarItem(title: "All Playlists", image: UIImage(systemName: "music.note.list"), action: { _, _ in }),

Readme.md

+12-58
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
11
# SPDiffable
22

3-
<a href="https://opensource.ivanvorobei.by/spdiffable/preview">
4-
<img align="left" src="https://cdn.ivanvorobei.by/github/spdiffable/example-app-preview-double.png" width="450"/>
5-
</a>
63

74
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.
85

9-
[![https://opensource.ivanvorobei.by/spdiffable/preview](https://github.com/ivanvorobei/Readme/blob/main/Buttons/video-preview.svg)](https://opensource.ivanvorobei.by/spdiffable/preview)
10-
11-
You can make sidebar, apply changes and make settings screen without making any cells or models.
12-
13-
If you like the project, don't forget to `put star ★`<br>Check out my other libraries:
14-
15-
<p float="left">
16-
<a href="https://opensource.ivanvorobei.by">
17-
<img src="https://github.com/ivanvorobei/Readme/blob/main/Buttons/more-libraries.svg">
18-
</a>
19-
</p>
20-
216
## Navigate
227

238
- [Installation](#installation)
@@ -33,15 +18,11 @@ If you like the project, don't forget to `put star ★`<br>Check out my other li
3318
- [Example](#ready-use)
3419
- [List classes](#ready-use-classes)
3520
- [Wrapper](#wrapper)
36-
- [Сontribution](#сontribution)
37-
- [Other Projects](#other-projects)
3821
- [Russian Community](#russian-community)
3922

4023
## Installation
4124

42-
Ready for use on iOS 13+. Works with Swift 5+. Required Xcode 12.0 and higher.
43-
44-
<img align="right" src="https://cdn.ivanvorobei.by/github/spdiffable/spm-install-preview.png" width="550"/>
25+
Ready for use on iOS 13+.
4526

4627
### Swift Package Manager
4728

@@ -51,13 +32,13 @@ Once you have your Swift package set up, adding as a dependency is as easy as ad
5132

5233
```swift
5334
dependencies: [
54-
.package(url: "https://github.com/ivanvorobei/SPDiffable.git", .upToNextMajor(from: "1.6.0"))
35+
.package(url: "https://github.com/ivanvorobei/SPDiffable.git", .upToNextMajor(from: "2.0.0"))
5536
]
5637
```
5738

5839
### CocoaPods:
5940

60-
[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate using CocoaPods, specify it in your `Podfile`:
41+
[CocoaPods](https://cocoapods.org) is a dependency manager. For usage and installation instructions, visit their website. To integrate using CocoaPods, specify it in your `Podfile`:
6142

6243
```ruby
6344
pod 'SPDiffable'
@@ -115,7 +96,7 @@ class DiffableTableController: SPDiffableTableController {
11596
}
11697
```
11798

118-
Now ready model and convert it to views. Time to add content. Read next section.
99+
Now ready model and convert it to views. Time to add content.
119100

120101
#### Apply Content
121102

@@ -126,7 +107,7 @@ Create content:
126107

127108
var content: [SPDiffableSection] {
128109
let section = SPDiffableSection(
129-
identifier: "example section",
110+
id: "example section",
130111
header: SPDiffableTextHeaderFooter(text: "Header"),
131112
footer: SPDiffableTextHeaderFooter(text: "Footer"),
132113
items: [
@@ -228,7 +209,7 @@ Content it array of `SPDiffableSection`. For menu model need use model `SPDiffab
228209

229210
```swift
230211
SPDiffableSection(
231-
identifier: Section.library.rawValue,
212+
id: Section.library.rawValue,
232213
header: SPDiffableSideBarHeader(text: "Library", accessories: [.outlineDisclosure()]),
233214
items: [
234215
SPDiffableSideBarItem(title: "Recently Added", image: UIImage(systemName: "clock"), action: { _ in }),
@@ -246,7 +227,7 @@ You can save time and count lines of code using ready-use classes. In project av
246227

247228
```swift
248229
let section = SPDiffableSection(
249-
identifier: "example section",
230+
id: "example section",
250231
header: SPDiffableTextHeaderFooter(text: "Header"),
251232
footer: SPDiffableTextHeaderFooter(text: "Footer"),
252233
items: [
@@ -312,41 +293,14 @@ Provided only models, becouse for most items using list registration and no need
312293
In project you can find class `SPDiffableWrapperItem`. Using it, when you don't want create custom item model for you diffable struct. You can pass any your model and uwrap it later in cell provider.
313294

314295
```swift
315-
let item = SPDiffableWrapperItem(identifier: "uniq-identifier", model: LocationRowModel(city: "Minsk"))
296+
let item = SPDiffableWrapperItem(id: "uniq-identifier", model: LocationRowModel(city: "Minsk"))
316297
```
317298

318-
## Сontribution
319-
320-
My English is very bad. You can see this once you read the documentation. I would really like to have clean and nice documentation. If you see gramatical errors and can help fix the Readme, please contact me hello@ivanvorobei.by or make a Pull Request. Thank you in advance!
321-
322-
## Other Projects
323-
324-
I love being helpful. Here I have provided a list of libraries that I keep up to date. For see `video previews` of libraries without install open [opensource.ivanvorobei.by](https://opensource.ivanvorobei.by) website.<br>
325-
I have libraries with native interface and managing permissions. Also available pack of useful extensions for boost your development process.
326-
327-
<p float="left">
328-
<a href="https://opensource.ivanvorobei.by">
329-
<img src="https://github.com/ivanvorobei/Readme/blob/main/Buttons/more-libraries.svg">
330-
</a>
331-
<a href="https://xcodeshop.ivanvorobei.by">
332-
<img src="https://github.com/ivanvorobei/Readme/blob/main/Buttons/xcode-shop.svg">
333-
</a>
334-
</p>
335-
336299
## Russian Community
337300

338-
Подписывайся в телеграмм-канал, если хочешь получать уведомления о новых туториалах.<br>
339-
Со сложными и непонятными задачами помогут в чате.
340-
341-
<p float="left">
342-
<a href="https://tutorials.ivanvorobei.by/telegram/channel">
343-
<img src="https://github.com/ivanvorobei/Readme/blob/main/Buttons/open-telegram-channel.svg">
344-
</a>
345-
<a href="https://tutorials.ivanvorobei.by/telegram/chat">
346-
<img src="https://github.com/ivanvorobei/Readme/blob/main/Buttons/russian-community-chat.svg">
347-
</a>
348-
</p>
301+
Я веду [телеграм-канал](https://sparrowcode.by/telegram), там публикую новости и туториалы.<br>
302+
С проблемой помогут [в чате](https://sparrowcode.by/telegram/chat).
349303

350-
Видео-туториалы выклыдываю на [YouTube](https://tutorials.ivanvorobei.by/youtube):
304+
Видео-туториалы выклыдываю на [YouTube](https://ivanvorobei.by/youtube):
351305

352-
[![Tutorials on YouTube](https://cdn.ivanvorobei.by/github/readme/youtube-preview.jpg)](https://tutorials.ivanvorobei.by/youtube)
306+
[![Tutorials on YouTube](https://cdn.ivanvorobei.by/github/readme/youtube-preview.jpg)](https://ivanvorobei.by/youtube)

SPDiffable.podspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Pod::Spec.new do |s|
22

33
s.name = 'SPDiffable'
4-
s.version = '1.6.8'
5-
s.summary = 'Extenshion of Diffable API which allow not duplicate code and use less models.'
4+
s.version = '2.0.0'
5+
s.summary = 'Extension of Diffable API which allow not duplicate code and use less models. Included example for SideBar.'
66
s.homepage = 'https://github.com/ivanvorobei/SPDiffable'
77
s.source = { :git => 'https://github.com/ivanvorobei/SPDiffable.git', :tag => s.version }
88
s.license = { :type => 'MIT', :file => "LICENSE" }

Sources/SPDiffable/Collection/Models/SPDiffableSideBarButton.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ open class SPDiffableSideBarButton: SPDiffableActionableItem {
3333
open var image: UIImage?
3434
open var accessories: [UICellAccessory]
3535

36-
public init(identifier: SPDiffableItem.Identifier? = nil, title: String, image: UIImage?, accessories: [UICellAccessory] = [], action: @escaping Action) {
36+
public init(id: SPDiffableItem.Identifier? = nil, title: String, image: UIImage?, accessories: [UICellAccessory] = [], action: @escaping Action) {
3737
self.title = title
3838
self.image = image
3939
self.accessories = accessories
40-
super.init(identifier: identifier ?? title, action: action)
40+
super.init(id: id ?? title, action: action)
4141
}
4242
}

Sources/SPDiffable/Collection/Models/SPDiffableSideBarHeader.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ open class SPDiffableSideBarHeader: SPDiffableItem {
3030
open var text: String
3131
open var accessories: [UICellAccessory]
3232

33-
public init(identifier: SPDiffableItem.Identifier? = nil, text: String, accessories: [UICellAccessory] = []) {
33+
public init(id: SPDiffableItem.Identifier? = nil, text: String, accessories: [UICellAccessory] = []) {
3434
self.text = text
3535
self.accessories = accessories
36-
super.init(identifier: identifier ?? text)
36+
super.init(id: id ?? text)
3737
}
3838
}

Sources/SPDiffable/Collection/Models/SPDiffableSideBarItem.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ open class SPDiffableSideBarItem: SPDiffableActionableItem {
3333
open var image: UIImage?
3434
open var accessories: [UICellAccessory]
3535

36-
public init(identifier: SPDiffableItem.Identifier? = nil, title: String, image: UIImage?, accessories: [UICellAccessory] = [], action: @escaping Action) {
36+
public init(id: SPDiffableItem.Identifier? = nil, title: String, image: UIImage?, accessories: [UICellAccessory] = [], action: @escaping Action) {
3737
self.title = title
3838
self.image = image
3939
self.accessories = accessories
40-
super.init(identifier: identifier ?? title, action: action)
40+
super.init(id: id ?? title, action: action)
4141
}
4242
}

Sources/SPDiffable/Collection/SPDiffableCollectionController.swift

+9
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ open class SPDiffableCollectionController: UICollectionViewController {
3434

3535
open weak var diffableDelegate: SPDiffableCollectionDelegate?
3636

37+
// MARK: - Lifecycle
38+
39+
open override func viewDidLoad() {
40+
super.viewDidLoad()
41+
collectionView.delaysContentTouches = false
42+
}
43+
44+
// MARK: - Init
45+
3746
/**
3847
SPDiffable: Init `diffableDataSource` and apply content to data source without animation.
3948

0 commit comments

Comments
 (0)