Merge pull request #181 from SoriUR/fix/configureSeparators_new_method

configureSeparators method
This commit is contained in:
SoriUR 2019-01-28 15:45:44 +03:00 committed by GitHub
commit c1c0f470d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 4 deletions

View File

@ -1,4 +1,8 @@
# Changelog
### 0.9.6
- **Add**: Add new `configureSeparators` method to `SeparatorRowBox` array.
### 0.9.5
- **Add**: `TitleType` enum, that defines `UIViewController`'s title type.
- **Add**: `UINavigationItem.largeTitleDisplayMode` property, that defines `UINavigationItem`'s large title display mode.

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "LeadKit"
s.version = "0.9.5"
s.version = "0.9.6"
s.summary = "iOS framework with a bunch of tools for rapid development"
s.homepage = "https://github.com/TouchInstinct/LeadKit"
s.license = "Apache License, Version 2.0"

View File

@ -35,17 +35,31 @@ public extension Array where Element == SeparatorRowBox {
func configureSeparators(extreme extremeSeparatorConfiguration: SeparatorConfiguration,
middle middleSeparatorConfiguration: SeparatorConfiguration) {
configureSeparators(first: extremeSeparatorConfiguration,
middle: middleSeparatorConfiguration,
last: extremeSeparatorConfiguration)
}
/// Configure separators from SeparatorRowBox array
/// - parameter first: Configuration of the top separator of the first row
/// - parameter middle: Configuration of the separators between the rows
/// - parameter last: Configuration of the bottom separator of the last row
func configureSeparators(first firstSeparatorConfiguration: SeparatorConfiguration,
middle middleSeparatorConfiguration: SeparatorConfiguration,
last lastSeparatorConfiguration: SeparatorConfiguration) {
if isEmpty {
return
}
switch count {
case 1:
first?.set(separatorType: .full(extremeSeparatorConfiguration, extremeSeparatorConfiguration))
first?.set(separatorType: .full(firstSeparatorConfiguration, lastSeparatorConfiguration))
default:
forEach { $0.set(separatorType: .bottom(middleSeparatorConfiguration)) }
first?.set(separatorType: .full(extremeSeparatorConfiguration, middleSeparatorConfiguration))
last?.set(separatorType: .bottom(extremeSeparatorConfiguration))
first?.set(separatorType: .full(firstSeparatorConfiguration, middleSeparatorConfiguration))
last?.set(separatorType: .bottom(lastSeparatorConfiguration))
}
}