-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from voyages-sncf-technologies/fix-collor-diff
Fix collor diff
- Loading branch information
Showing
11 changed files
with
468 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
Example/Collor/TextFieldSample/TextFieldCollectionData.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// TextFieldCollectionData.swift | ||
// Collor_Example | ||
// | ||
// Created by Deffrasnes Ghislain on 07/05/2020. | ||
// Copyright © 2020 CocoaPods. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Collor | ||
|
||
final class TextFieldCollectionData: CollectionData { | ||
|
||
var numberOfCell = 2 | ||
|
||
var sectionToReload: CollectionSectionDescribable? | ||
|
||
override func reloadData() { | ||
super.reloadData() | ||
|
||
let section1 = TextFieldSectionDescriptor().uid("section1_id").reloadSection { cells in | ||
let cellDescriptor = TextFieldDescriptor(adapter: TextFieldAdapter()).uid("cell1_id") | ||
cells.append(cellDescriptor) | ||
} | ||
sections.append(section1) | ||
|
||
let section2 = TextFieldSectionDescriptor().uid("section2_id").reloadSection { [weak self] cells in | ||
guard let self = self else { | ||
return | ||
} | ||
|
||
if self.numberOfCell == 2 { | ||
let cellDescriptor = TextFieldDescriptor(adapter: TextFieldAdapter()).uid("cell2_id") | ||
cells.append(cellDescriptor) | ||
} | ||
|
||
self.numberOfCell = self.numberOfCell == 2 ? 1 : 2 | ||
} | ||
sections.append(section2) | ||
self.sectionToReload = section2 | ||
} | ||
|
||
} |
Oops, something went wrong.