From 9517e1151e39e85f72e5f24357d72f90d682c4e7 Mon Sep 17 00:00:00 2001 From: Iurii Date: Sun, 27 Jan 2019 07:27:10 +0300 Subject: [PATCH 1/2] Add a method --- CHANGELOG.md | 4 ++++ LeadKit.podspec | 2 +- .../Array+SeparatorRowBoxExtensions.swift | 20 ++++++++++++++++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e6c08b7..04206bf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/LeadKit.podspec b/LeadKit.podspec index d213fcff..de4cd854 100644 --- a/LeadKit.podspec +++ b/LeadKit.podspec @@ -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" diff --git a/Sources/Extensions/Array/Array+SeparatorRowBoxExtensions.swift b/Sources/Extensions/Array/Array+SeparatorRowBoxExtensions.swift index 690b26a0..62c24b38 100644 --- a/Sources/Extensions/Array/Array+SeparatorRowBoxExtensions.swift +++ b/Sources/Extensions/Array/Array+SeparatorRowBoxExtensions.swift @@ -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 top: Configuration of the top separator of the first row + /// - parameter middle: Configuration of the separators between the rows + /// - parameter bottom: Configuration of the bottom separator of the last row + func configureSeparators(first topSeparatorConfiguration: SeparatorConfiguration, + middle middleSeparatorConfiguration: SeparatorConfiguration, + last bottomSeparatorConfiguration: SeparatorConfiguration) { + if isEmpty { return } switch count { case 1: - first?.set(separatorType: .full(extremeSeparatorConfiguration, extremeSeparatorConfiguration)) + first?.set(separatorType: .full(topSeparatorConfiguration, bottomSeparatorConfiguration)) + default: forEach { $0.set(separatorType: .bottom(middleSeparatorConfiguration)) } - first?.set(separatorType: .full(extremeSeparatorConfiguration, middleSeparatorConfiguration)) - last?.set(separatorType: .bottom(extremeSeparatorConfiguration)) + first?.set(separatorType: .full(topSeparatorConfiguration, middleSeparatorConfiguration)) + last?.set(separatorType: .bottom(bottomSeparatorConfiguration)) } } From 6b04a0fb327bccaecd2d4a3272a1862c9fdaa60f Mon Sep 17 00:00:00 2001 From: Iurii Date: Sun, 27 Jan 2019 07:35:57 +0300 Subject: [PATCH 2/2] Rename the vars --- .../Array/Array+SeparatorRowBoxExtensions.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/Extensions/Array/Array+SeparatorRowBoxExtensions.swift b/Sources/Extensions/Array/Array+SeparatorRowBoxExtensions.swift index 62c24b38..dd01f313 100644 --- a/Sources/Extensions/Array/Array+SeparatorRowBoxExtensions.swift +++ b/Sources/Extensions/Array/Array+SeparatorRowBoxExtensions.swift @@ -41,12 +41,12 @@ public extension Array where Element == SeparatorRowBox { } /// Configure separators from SeparatorRowBox array - /// - parameter top: Configuration of the top separator of the first row + /// - parameter first: Configuration of the top separator of the first row /// - parameter middle: Configuration of the separators between the rows - /// - parameter bottom: Configuration of the bottom separator of the last row - func configureSeparators(first topSeparatorConfiguration: SeparatorConfiguration, + /// - parameter last: Configuration of the bottom separator of the last row + func configureSeparators(first firstSeparatorConfiguration: SeparatorConfiguration, middle middleSeparatorConfiguration: SeparatorConfiguration, - last bottomSeparatorConfiguration: SeparatorConfiguration) { + last lastSeparatorConfiguration: SeparatorConfiguration) { if isEmpty { return @@ -54,12 +54,12 @@ public extension Array where Element == SeparatorRowBox { switch count { case 1: - first?.set(separatorType: .full(topSeparatorConfiguration, bottomSeparatorConfiguration)) + first?.set(separatorType: .full(firstSeparatorConfiguration, lastSeparatorConfiguration)) default: forEach { $0.set(separatorType: .bottom(middleSeparatorConfiguration)) } - first?.set(separatorType: .full(topSeparatorConfiguration, middleSeparatorConfiguration)) - last?.set(separatorType: .bottom(bottomSeparatorConfiguration)) + first?.set(separatorType: .full(firstSeparatorConfiguration, middleSeparatorConfiguration)) + last?.set(separatorType: .bottom(lastSeparatorConfiguration)) } }