diff --git a/CHANGELOG.md b/CHANGELOG.md index 78ee81b5..b6bdfced 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### 0.6.7 + +- **Add**: UITableView extension to add colored background for tableview bounce area. + ### 0.6.6 - **Add**: Ability to map primitive response types (`String`, `Int`, `[String]`, etc.). diff --git a/LeadKit.podspec b/LeadKit.podspec index 00cb1bc9..92033000 100644 --- a/LeadKit.podspec +++ b/LeadKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKit" - s.version = "0.6.6" + s.version = "0.6.7" 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" @@ -59,6 +59,7 @@ Pod::Spec.new do |s| "Sources/Extensions/UICollectionView/*", "Sources/Extensions/UIDevice/*", "Sources/Extensions/UIImage/*", + "Sources/Extensions/UITableView/*", "Sources/Extensions/UIView/*", "Sources/Extensions/UIViewController/*", "Sources/Extensions/UIWindow/*", diff --git a/LeadKit.xcodeproj/project.pbxproj b/LeadKit.xcodeproj/project.pbxproj index e2d33475..e9812181 100644 --- a/LeadKit.xcodeproj/project.pbxproj +++ b/LeadKit.xcodeproj/project.pbxproj @@ -10,6 +10,8 @@ 2D6A0E6105F4A9BF22BF4BB1 /* Pods_LeadKit_iOS_ExtensionsTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C88ED8C9373F85C06697849 /* Pods_LeadKit_iOS_ExtensionsTests.framework */; }; 2D96F18874B9519F5AD74003 /* Pods_LeadKit_LeadKit_tvOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0F8D0002B21A4F31981F1ED /* Pods_LeadKit_LeadKit_tvOS.framework */; }; 3614FEACB9E8313C87F7C393 /* Pods_LeadKit_tvOSTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DB1CCAB1EAAACD3AC42C795 /* Pods_LeadKit_tvOSTests.framework */; }; + 36977763200CF12100ED9C6E /* UITableView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36DAAF502007CC920090BE0D /* UITableView+Extensions.swift */; }; + 36DAAF512007CC920090BE0D /* UITableView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36DAAF502007CC920090BE0D /* UITableView+Extensions.swift */; }; 40F118471F8FEF97004AADAF /* AppearanceConfigurable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40F118461F8FEF97004AADAF /* AppearanceConfigurable.swift */; }; 40F118491F8FF223004AADAF /* TableRow+AppearanceExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40F118481F8FF223004AADAF /* TableRow+AppearanceExtension.swift */; }; 67051ADB1EBC7C36008EADC0 /* SpinnerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67051ADA1EBC7C36008EADC0 /* SpinnerView.swift */; }; @@ -478,6 +480,7 @@ 1DA955AE397186D4042066E0 /* Pods-LeadKit-LeadKit iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LeadKit-LeadKit iOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-LeadKit-LeadKit iOS/Pods-LeadKit-LeadKit iOS.debug.xcconfig"; sourceTree = ""; }; 287AC0683207753A363152CB /* Pods_LeadKit_watchOSTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LeadKit_watchOSTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 2BD6FE790236CFF8D2CD505E /* Pods-LeadKit-LeadKit iOS Extensions.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LeadKit-LeadKit iOS Extensions.release.xcconfig"; path = "Pods/Target Support Files/Pods-LeadKit-LeadKit iOS Extensions/Pods-LeadKit-LeadKit iOS Extensions.release.xcconfig"; sourceTree = ""; }; + 36DAAF502007CC920090BE0D /* UITableView+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableView+Extensions.swift"; sourceTree = ""; }; 381DF859FC4E26D499123014 /* Pods-LeadKit iOS ExtensionsTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LeadKit iOS ExtensionsTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-LeadKit iOS ExtensionsTests/Pods-LeadKit iOS ExtensionsTests.release.xcconfig"; sourceTree = ""; }; 3C88ED8C9373F85C06697849 /* Pods_LeadKit_iOS_ExtensionsTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LeadKit_iOS_ExtensionsTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 40F118461F8FEF97004AADAF /* AppearanceConfigurable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppearanceConfigurable.swift; sourceTree = ""; }; @@ -709,6 +712,14 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 36DAAF4F2007CC330090BE0D /* UITableView */ = { + isa = PBXGroup; + children = ( + 36DAAF502007CC920090BE0D /* UITableView+Extensions.swift */, + ); + path = UITableView; + sourceTree = ""; + }; 671461C41EB3396E00EAB194 /* Classes */ = { isa = PBXGroup; children = ( @@ -812,6 +823,7 @@ 679C77D51F98F7A60094BE10 /* UIAlertController */, 671462081EB3396E00EAB194 /* UIColor */, 6714620C1EB3396E00EAB194 /* UIImage */, + 36DAAF4F2007CC330090BE0D /* UITableView */, 671462111EB3396E00EAB194 /* UIView */, 671462171EB3396E00EAB194 /* UIViewController */, 6714621B1EB3396E00EAB194 /* UIWindow */, @@ -2219,6 +2231,7 @@ 672CC2B31FEA72A000EBFB0A /* FloatingPoint+DegreesRadiansConvertion.swift in Sources */, 671462901EB3396E00EAB194 /* CGImage+Crop.swift in Sources */, 671462FC1EB3396E00EAB194 /* UIView+XibNameProtocol.swift in Sources */, + 36DAAF512007CC920090BE0D /* UITableView+Extensions.swift in Sources */, 671463841EB3396E00EAB194 /* ResizeDrawingOperation.swift in Sources */, 6771DFD81EE99EBA002DCDAE /* DateFormattingService.swift in Sources */, 671462D01EB3396E00EAB194 /* UIScrollView+Support.swift in Sources */, @@ -2498,6 +2511,7 @@ 6714624B1EB3396E00EAB194 /* FixedPageCursor.swift in Sources */, 671462CB1EB3396E00EAB194 /* String+Localization.swift in Sources */, 67F13A271FAB5B25008175B4 /* GeneralLoadingState.swift in Sources */, + 36977763200CF12100ED9C6E /* UITableView+Extensions.swift in Sources */, 671462BB1EB3396E00EAB194 /* Sequence+ConcurrentMap.swift in Sources */, 671463771EB3396E00EAB194 /* BorderDrawingOperation.swift in Sources */, 6714633F1EB3396E00EAB194 /* LoadingIndicator.swift in Sources */, diff --git a/Sources/Extensions/UITableView/UITableView+Extensions.swift b/Sources/Extensions/UITableView/UITableView+Extensions.swift new file mode 100644 index 00000000..d6fbdced --- /dev/null +++ b/Sources/Extensions/UITableView/UITableView+Extensions.swift @@ -0,0 +1,41 @@ +// +// Copyright (c) 2018 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import UIKit + +public extension UITableView { + + /// Adds colored background to the top of the tableview. + /// + /// - Parameters: + /// - color: header background color + func addHeaderBackground(with color: UIColor) { + let backgroundView = UIView() + backgroundView.backgroundColor = color + addSubview(backgroundView) + backgroundView.translatesAutoresizingMaskIntoConstraints = false + NSLayoutConstraint.activate([backgroundView.leadingAnchor.constraint(equalTo: leadingAnchor), + backgroundView.bottomAnchor.constraint(equalTo: topAnchor), + backgroundView.widthAnchor.constraint(equalTo: widthAnchor), + backgroundView.heightAnchor.constraint(equalTo: heightAnchor)]) + } +}