diff --git a/Cartfile b/Cartfile index 421fe1d..dfea7fe 100644 --- a/Cartfile +++ b/Cartfile @@ -5,7 +5,6 @@ binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/RxAlamofire binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/KeychainAccess/KeychainAccess.json" binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/CryptoSwift/CryptoSwift.json" binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/SwiftValidator/SwiftValidator.json" -binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/PinLayout/PinLayout.json" binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/TableKit/TableKit.json" binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/RxSwift/RxSwift.json" binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/UIScrollView_InfiniteScroll/UIScrollView_InfiniteScroll.json" diff --git a/Cartfile.resolved b/Cartfile.resolved index a7f63b9..e168b3e 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,8 +1,7 @@ binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/Alamofire/Alamofire.json" "4.8.1" binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/CryptoSwift/CryptoSwift.json" "0.14.0" -binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/KeychainAccess/KeychainAccess.json" "3.1.2" -binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/LeadKit/LeadKit.json" "0.9.12" -binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/PinLayout/PinLayout.json" "1.8.6" +binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/KeychainAccess/KeychainAccess.json" "3.2.0" +binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/LeadKit/LeadKit.json" "0.9.15" binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/RxAlamofire/RxAlamofire.json" "4.3.0" binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/RxSwift/RxSwift.json" "4.4.2" binary "https://raw.github.com/TouchInstinct/CarthageBinaries/master/SwiftDate/SwiftDate.json" "5.1.0" diff --git a/LeadKitAdditions.xcodeproj/project.pbxproj b/LeadKitAdditions.xcodeproj/project.pbxproj index 363da88..1d65acf 100644 --- a/LeadKitAdditions.xcodeproj/project.pbxproj +++ b/LeadKitAdditions.xcodeproj/project.pbxproj @@ -7,18 +7,11 @@ objects = { /* Begin PBXBuildFile section */ - 6760AF1A207268EC00C2BB7E /* PinLayoutCell+DefaultImplementation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6760AF19207268EC00C2BB7E /* PinLayoutCell+DefaultImplementation.swift */; }; 67779CBC206986390098F024 /* BaseTextFieldViewEvents+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67779CBB206986390098F024 /* BaseTextFieldViewEvents+Extensions.swift */; }; 678D26AA206935B900B05B93 /* BiometricsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 678D26A9206935B900B05B93 /* BiometricsService.swift */; }; 67B4E6F6206945DD00E233EA /* OnlineValidationResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67B4E6F5206945DC00E233EA /* OnlineValidationResult.swift */; }; 67B4E6F9206945F900E233EA /* OnlineValidationState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67B4E6F8206945F900E233EA /* OnlineValidationState.swift */; }; 67B4E6FB20694A4200E233EA /* BaseTextFieldViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67B4E6F1206945D200E233EA /* BaseTextFieldViewModel.swift */; }; - 67C2A41620724BBA000A5682 /* SeparatorTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67C2A41520724BBA000A5682 /* SeparatorTableViewCell.swift */; }; - 67C2A41820724EA0000A5682 /* LabelTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67C2A41720724EA0000A5682 /* LabelTableViewCell.swift */; }; - 67C2A41B20724F40000A5682 /* LabelCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67C2A41A20724F40000A5682 /* LabelCellViewModel.swift */; }; - 67C2A41D20725359000A5682 /* LabelTableViewCell+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67C2A41C20725359000A5682 /* LabelTableViewCell+Extensions.swift */; }; - 67CF05AA206E9880009A2AB9 /* PinLayoutCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67CF05A9206E9880009A2AB9 /* PinLayoutCell.swift */; }; - 67CF05B0206E99DF009A2AB9 /* PinLayoutTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67CF05AF206E99DF009A2AB9 /* PinLayoutTableViewCell.swift */; }; 67D6041821627600002DAF5B /* LegacyConfigurableController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67D6041721627600002DAF5B /* LegacyConfigurableController.swift */; }; 786CBB2F220DD7A70017587F /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 786CBB22220DD7A70017587F /* RxSwift.framework */; }; 786CBB30220DD7A70017587F /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 786CBB23220DD7A70017587F /* Alamofire.framework */; }; @@ -32,7 +25,6 @@ 786CBB38220DD7A70017587F /* RxCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 786CBB2B220DD7A70017587F /* RxCocoa.framework */; }; 786CBB39220DD7A70017587F /* CryptoSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 786CBB2C220DD7A70017587F /* CryptoSwift.framework */; }; 786CBB3A220DD7A70017587F /* KeychainAccess.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 786CBB2D220DD7A70017587F /* KeychainAccess.framework */; }; - 786CBB3B220DD7A70017587F /* PinLayout.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 786CBB2E220DD7A70017587F /* PinLayout.framework */; }; A6CFB8D91F5024A500A42CC2 /* Error+NetworkingExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6CFB8D81F5024A500A42CC2 /* Error+NetworkingExtensions.swift */; }; CAE698E81E968820000394B0 /* LeadKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = CAE698E61E968820000394B0 /* LeadKitAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; ED0C34071F2906EC00FAE9FD /* LoadingBarButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED0C33D51F2906EC00FAE9FD /* LoadingBarButton.swift */; }; @@ -55,18 +47,11 @@ /* Begin PBXFileReference section */ 67528BCE206E3CC6009F2525 /* iOS.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = iOS.playground; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; - 6760AF19207268EC00C2BB7E /* PinLayoutCell+DefaultImplementation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PinLayoutCell+DefaultImplementation.swift"; sourceTree = ""; }; 67779CBB206986390098F024 /* BaseTextFieldViewEvents+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BaseTextFieldViewEvents+Extensions.swift"; sourceTree = ""; }; 678D26A9206935B900B05B93 /* BiometricsService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BiometricsService.swift; sourceTree = ""; }; 67B4E6F1206945D200E233EA /* BaseTextFieldViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseTextFieldViewModel.swift; sourceTree = ""; }; 67B4E6F5206945DC00E233EA /* OnlineValidationResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnlineValidationResult.swift; sourceTree = ""; }; 67B4E6F8206945F900E233EA /* OnlineValidationState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnlineValidationState.swift; sourceTree = ""; }; - 67C2A41520724BBA000A5682 /* SeparatorTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeparatorTableViewCell.swift; sourceTree = ""; }; - 67C2A41720724EA0000A5682 /* LabelTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelTableViewCell.swift; sourceTree = ""; }; - 67C2A41A20724F40000A5682 /* LabelCellViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelCellViewModel.swift; sourceTree = ""; }; - 67C2A41C20725359000A5682 /* LabelTableViewCell+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LabelTableViewCell+Extensions.swift"; sourceTree = ""; }; - 67CF05A9206E9880009A2AB9 /* PinLayoutCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinLayoutCell.swift; sourceTree = ""; }; - 67CF05AF206E99DF009A2AB9 /* PinLayoutTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinLayoutTableViewCell.swift; sourceTree = ""; }; 67D6041721627600002DAF5B /* LegacyConfigurableController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyConfigurableController.swift; sourceTree = ""; }; 786CBB22220DD7A70017587F /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxSwift.framework; path = Carthage/Build/iOS/RxSwift.framework; sourceTree = ""; }; 786CBB23220DD7A70017587F /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Alamofire.framework; path = Carthage/Build/iOS/Alamofire.framework; sourceTree = ""; }; @@ -121,23 +106,12 @@ 786CBB38220DD7A70017587F /* RxCocoa.framework in Frameworks */, 786CBB39220DD7A70017587F /* CryptoSwift.framework in Frameworks */, 786CBB3A220DD7A70017587F /* KeychainAccess.framework in Frameworks */, - 786CBB3B220DD7A70017587F /* PinLayout.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 67528BCB206E3C12009F2525 /* Cells */ = { - isa = PBXGroup; - children = ( - 67C2A41920724F32000A5682 /* LabelTableViewCell */, - 67CF05AF206E99DF009A2AB9 /* PinLayoutTableViewCell.swift */, - 67C2A41520724BBA000A5682 /* SeparatorTableViewCell.swift */, - ); - path = Cells; - sourceTree = ""; - }; 67B4E6F0206945D200E233EA /* BaseTextFieldViewModel */ = { isa = PBXGroup; children = ( @@ -154,32 +128,6 @@ path = ValidationService; sourceTree = ""; }; - 67C2A41920724F32000A5682 /* LabelTableViewCell */ = { - isa = PBXGroup; - children = ( - 67C2A41720724EA0000A5682 /* LabelTableViewCell.swift */, - 67C2A41A20724F40000A5682 /* LabelCellViewModel.swift */, - ); - path = LabelTableViewCell; - sourceTree = ""; - }; - 67CF05A8206E986A009A2AB9 /* Cells */ = { - isa = PBXGroup; - children = ( - 67CF05A9206E9880009A2AB9 /* PinLayoutCell.swift */, - ); - path = Cells; - sourceTree = ""; - }; - 67CF05AC206E9931009A2AB9 /* Cells */ = { - isa = PBXGroup; - children = ( - 67C2A41C20725359000A5682 /* LabelTableViewCell+Extensions.swift */, - 6760AF19207268EC00C2BB7E /* PinLayoutCell+DefaultImplementation.swift */, - ); - path = Cells; - sourceTree = ""; - }; A3117951840B8B7D2E7A8A80 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -236,7 +184,6 @@ ED0C33D21F2906EC00FAE9FD /* Classes */ = { isa = PBXGroup; children = ( - 67528BCB206E3C12009F2525 /* Cells */, 67B4E6F0206945D200E233EA /* BaseTextFieldViewModel */, ED0C33D51F2906EC00FAE9FD /* LoadingBarButton.swift */, ); @@ -293,7 +240,6 @@ ED0C33E61F2906EC00FAE9FD /* Extensions */ = { isa = PBXGroup; children = ( - 67CF05AC206E9931009A2AB9 /* Cells */, ED0C33E81F2906EC00FAE9FD /* UIBarButtonItem+Extensions.swift */, ED0C33E91F2906EC00FAE9FD /* UserDefaults+UserService.swift */, A6CFB8D81F5024A500A42CC2 /* Error+NetworkingExtensions.swift */, @@ -305,7 +251,6 @@ ED0C33EA1F2906EC00FAE9FD /* Protocols */ = { isa = PBXGroup; children = ( - 67CF05A8206E986A009A2AB9 /* Cells */, 67B4E6F4206945DC00E233EA /* ValidationService */, 67D6041721627600002DAF5B /* LegacyConfigurableController.swift */, ); @@ -439,29 +384,22 @@ ED0C343F1F2906EC00FAE9FD /* ValidationError.swift in Sources */, ED0C342F1F2906EC00FAE9FD /* BaseUserService.swift in Sources */, 678D26AA206935B900B05B93 /* BiometricsService.swift in Sources */, - 67C2A41D20725359000A5682 /* LabelTableViewCell+Extensions.swift in Sources */, ED0C34411F2906EC00FAE9FD /* ValidationItem.swift in Sources */, ED0C341F1F2906EC00FAE9FD /* UIBarButtonItem+Extensions.swift in Sources */, - 67C2A41820724EA0000A5682 /* LabelTableViewCell.swift in Sources */, ED0C34091F2906EC00FAE9FD /* PassCodeConfiguration.swift in Sources */, EF5A43B1206E7A67003CED07 /* PassCodeDelayedDescription.swift in Sources */, - 67CF05B0206E99DF009A2AB9 /* PinLayoutTableViewCell.swift in Sources */, ED0C34131F2906EC00FAE9FD /* BasePassCodeViewController.swift in Sources */, - 67C2A41620724BBA000A5682 /* SeparatorTableViewCell.swift in Sources */, ED0C342D1F2906EC00FAE9FD /* BasePassCodeService.swift in Sources */, 67B4E6F9206945F900E233EA /* OnlineValidationState.swift in Sources */, 67779CBC206986390098F024 /* BaseTextFieldViewEvents+Extensions.swift in Sources */, ED0C340D1F2906EC00FAE9FD /* PassCodeHolder.swift in Sources */, - 67CF05AA206E9880009A2AB9 /* PinLayoutCell.swift in Sources */, A6CFB8D91F5024A500A42CC2 /* Error+NetworkingExtensions.swift in Sources */, ED0C34071F2906EC00FAE9FD /* LoadingBarButton.swift in Sources */, - 6760AF1A207268EC00C2BB7E /* PinLayoutCell+DefaultImplementation.swift in Sources */, ED0C34211F2906EC00FAE9FD /* UserDefaults+UserService.swift in Sources */, ED0C34111F2906EC00FAE9FD /* PassCodeValidationResult.swift in Sources */, ED0C34431F2906EC00FAE9FD /* ValidationService.swift in Sources */, ED0C340B1F2906EC00FAE9FD /* PassCodeError.swift in Sources */, 67B4E6F6206945DD00E233EA /* OnlineValidationResult.swift in Sources */, - 67C2A41B20724F40000A5682 /* LabelCellViewModel.swift in Sources */, ED0C34151F2906EC00FAE9FD /* BasePassCodeViewModel.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Sources/Classes/Cells/LabelTableViewCell/LabelCellViewModel.swift b/Sources/Classes/Cells/LabelTableViewCell/LabelCellViewModel.swift deleted file mode 100644 index 5ae28e1..0000000 --- a/Sources/Classes/Cells/LabelTableViewCell/LabelCellViewModel.swift +++ /dev/null @@ -1,55 +0,0 @@ -// -// 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.UIGeometry -import LeadKit - -/// Default view model for LabelTableViewCell. -open class LabelCellViewModel { - - public let viewText: ViewText - public let contentBackground: ViewBackground - public let contentInsets: UIEdgeInsets - public let labelInsets: UIEdgeInsets - public let separatorType: CellSeparatorType - - /// Memberwise initializer. - /// - /// - Parameters: - /// - viewText: View text to configure label. - /// - contentBackground: View background to configure background. - /// - contentInsets: Content insets to use for layout whole content. - /// - labelInsets: Label insets to use for layout label. - /// - separatorType: Separator type to use for separators. - public init(viewText: ViewText, - contentBackground: ViewBackground = .color(.clear), - contentInsets: UIEdgeInsets = .zero, - labelInsets: UIEdgeInsets = .zero, - separatorType: CellSeparatorType = .none) { - - self.viewText = viewText - self.contentBackground = contentBackground - self.contentInsets = contentInsets - self.labelInsets = labelInsets - self.separatorType = separatorType - } -} diff --git a/Sources/Classes/Cells/LabelTableViewCell/LabelTableViewCell.swift b/Sources/Classes/Cells/LabelTableViewCell/LabelTableViewCell.swift deleted file mode 100644 index 026820b..0000000 --- a/Sources/Classes/Cells/LabelTableViewCell/LabelTableViewCell.swift +++ /dev/null @@ -1,139 +0,0 @@ -// -// 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 -import LeadKit -import PinLayout - -/// Pin layout cell with separators, background and label. -open class LabelTableViewCell: SeparatorTableViewCell { - - private let label = UILabel(frame: .zero) - private let backgroundImageView = UIImageView(frame: .zero) - private let contentContainerView = UIView(frame: .zero) - - private var viewModel: LabelCellViewModel? - - // MARK: - PinLayoutTableViewCell - - override open func addViews() { - super.addViews() - - contentContainerView.addSubviews(backgroundImageView, label) - - contentView.addSubview(contentContainerView) - } - - override open func configureAppearance() { - super.configureAppearance() - - selectionStyle = .none - backgroundColor = .clear - - contentView.backgroundColor = .clear - - configureAppearance(of: label, backgroundImageView: backgroundImageView) - } - - override open func layout() { - let topSeparatorHeight = viewModel?.separatorType.topConfiguration?.totalHeight ?? 0 - let bottomSeparatorHeight = viewModel?.separatorType.bottomConfiguration?.totalHeight ?? 0 - - contentContainerView.pin - .top(topSeparatorHeight + contentInsets.top) - .horizontally(contentInsets) - .bottom(contentInsets.bottom + bottomSeparatorHeight) - .layout() - - label.pin - .top(labelInsets) - .horizontally(labelInsets) - .sizeToFit(.width) - .layout() - - backgroundImageView.pin - .all() - .layout() - - // bottom separator positioning after content size (height) calculation - super.layout() - } - - private var labelInsets: UIEdgeInsets { - return viewModel?.labelInsets ?? .zero - } - - private var contentInsets: UIEdgeInsets { - return viewModel?.contentInsets ?? .zero - } - - override open var contentHeight: CGFloat { - let selfContentHeight = contentInsets.top + - labelInsets.top + - label.frame.height + - labelInsets.bottom + - contentInsets.bottom - - return selfContentHeight + super.contentHeight - } - - // MARK: - Subclass methods to override - - /// Callback for label and background image view appearance configuration. - /// - /// - Parameters: - /// - label: Internal UILabel instance to configure. - /// - backgroundImageView: Internal UIImageView instance to configure. - open func configureAppearance(of label: UILabel, backgroundImageView: UIImageView) { - label.numberOfLines = 0 - } - - // MARK: - Configuration methods - - /// Convenient method for configuration cell with LabelCellViewModel. - /// - /// - Parameter viewModel: LabelCellViewModel instance. - public func configureLabelCell(with viewModel: LabelCellViewModel) { - self.viewModel = viewModel - - configureSeparator(with: viewModel.separatorType) - configureLabelText(with: viewModel.viewText) - configureContentBackground(with: viewModel.contentBackground) - - setNeedsLayout() - } - - /// Method for background configuration. - /// - /// - Parameter contentBackground: Content background to use as background. - public func configureContentBackground(with contentBackground: ViewBackground) { - contentBackground.configure(backgroundView: contentContainerView, - backgroundImageView: backgroundImageView) - } - - /// Method for text configuration. - /// - /// - Parameter viewText: View text to use as background. - public func configureLabelText(with viewText: ViewText) { - label.configure(with: viewText) - } -} diff --git a/Sources/Classes/Cells/PinLayoutTableViewCell.swift b/Sources/Classes/Cells/PinLayoutTableViewCell.swift deleted file mode 100644 index 20f9b6b..0000000 --- a/Sources/Classes/Cells/PinLayoutTableViewCell.swift +++ /dev/null @@ -1,102 +0,0 @@ -// -// 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 -import PinLayout - -/// Cell that uses PinLayout. Contains methods that should be overriden in subclasses. -open class PinLayoutTableViewCell: UITableViewCell, PinLayoutCell { - - public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - super.init(style: style, reuseIdentifier: reuseIdentifier) - - initializeCell() - } - - public required init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) - - initializeCell() - } - - open override func sizeThatFits(_ size: CGSize) -> CGSize { - return layout(with: size) - } - - open override func layoutSubviews() { - super.layoutSubviews() - - layout() - } - - // MARK: - PinLayoutCell - - open func initializeCell() { - addViews() - configureAppearance() - configureLayout() - } - - open func layout(with containerSize: CGSize) -> CGSize { - // 1) Set the contentView's width to the specified size parameter - contentView.pin.width(containerSize.width).layout() - - // 2) Layout the contentView's controls - layout() - - // 3) Returns a size that contains all controls - return CGSize(width: contentView.frame.width, - height: contentHeight) - } - - open func addViews() { - // override in subclass - - // move from _UISnapshotWindow superview in Playground - addSubview(contentView) - } - - open func configureAppearance() { - // override in subclass - } - - open func configureLayout() { - // override in subclass - } - - open func layout() { - // override in subclass - } - - open var contentHeight: CGFloat { - return contentView.subviewsMaxY - } -} - -private extension UIView { - - var subviewsMaxY: CGFloat { - return subviews - .map { $0.frame.maxY } - .max() ?? frame.maxY - } -} diff --git a/Sources/Classes/Cells/SeparatorTableViewCell.swift b/Sources/Classes/Cells/SeparatorTableViewCell.swift deleted file mode 100644 index 3d74525..0000000 --- a/Sources/Classes/Cells/SeparatorTableViewCell.swift +++ /dev/null @@ -1,102 +0,0 @@ -// -// 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 -import LeadKit -import PinLayout - -/// Pin layout cell with top and bottom separators. -open class SeparatorTableViewCell: PinLayoutTableViewCell { - - private let topSeparator = UIView(frame: .zero) - private let bottomSeparator = UIView(frame: .zero) - - private var separatorType: CellSeparatorType = .none - - /// Configure separator with viewModel. - /// - parameter separatorType: type of separators. - public func configureSeparator(with separatorType: CellSeparatorType) { - self.separatorType = separatorType - - separatorType.configure(topSeparatorView: topSeparator, - bottomSeparatorView: bottomSeparator) - - setNeedsLayout() - } - - /// Move separator upward in hierarchy - public func bringSeparatorsToFront() { - contentView.bringSubviewToFront(topSeparator) - contentView.bringSubviewToFront(bottomSeparator) - } - - /// Move separator backward in hierarchy - public func sendSeparatorsToBack() { - contentView.sendSubviewToBack(topSeparator) - contentView.sendSubviewToBack(bottomSeparator) - } - - // MARK: - PinLayoutTableViewCell - - override open func addViews() { - super.addViews() - - contentView.addSubviews(topSeparator, bottomSeparator) - } - - override open func layout() { - super.layout() - - if let topConfiguration = separatorType.topConfiguration { - topSeparator.pin - .top(topConfiguration.insets) - .horizontally(topConfiguration.insets) - .height(topConfiguration.height) - .layout() - } - - if let bottomConfiguration = separatorType.bottomConfiguration { - let topInset = contentHeight - (bottomConfiguration.height + bottomConfiguration.insets.bottom) - - bottomSeparator.pin - .top(topInset) - .horizontally(bottomConfiguration.insets) - .height(bottomConfiguration.height) - .layout() - } - } - - override open var contentHeight: CGFloat { - let topSeparatorHeight = separatorType.topConfiguration?.totalHeight ?? 0 - let bottomSeparatorHeight = separatorType.bottomConfiguration?.totalHeight ?? 0 - - return topSeparatorHeight + bottomSeparatorHeight - } - - // MARK: - UITableViewCell - - override open func prepareForReuse() { - super.prepareForReuse() - - configureSeparator(with: .none) - } -} diff --git a/Sources/Extensions/Cells/LabelTableViewCell+Extensions.swift b/Sources/Extensions/Cells/LabelTableViewCell+Extensions.swift deleted file mode 100644 index 5958943..0000000 --- a/Sources/Extensions/Cells/LabelTableViewCell+Extensions.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// 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 TableKit - -extension LabelTableViewCell: ConfigurableCell { - - public func configure(with viewModel: LabelCellViewModel) { - configureLabelCell(with: viewModel) - } -} diff --git a/Sources/Extensions/Cells/PinLayoutCell+DefaultImplementation.swift b/Sources/Extensions/Cells/PinLayoutCell+DefaultImplementation.swift deleted file mode 100644 index 9713da0..0000000 --- a/Sources/Extensions/Cells/PinLayoutCell+DefaultImplementation.swift +++ /dev/null @@ -1,32 +0,0 @@ -// -// 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 Foundation - -public extension PinLayoutCell { - - func initializeCell() { - addViews() - configureAppearance() - configureLayout() - } -} diff --git a/Sources/Protocols/Cells/PinLayoutCell.swift b/Sources/Protocols/Cells/PinLayoutCell.swift deleted file mode 100644 index da1d9e0..0000000 --- a/Sources/Protocols/Cells/PinLayoutCell.swift +++ /dev/null @@ -1,59 +0,0 @@ -// -// 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 CoreGraphics.CGBase - -/// Protocol with methods for configuration and layout cell. -public protocol PinLayoutCell { - - /// Method is called when cell initialized from nib or from code. - func initializeCell() - - /// Method for adding subviews to content view. - /// - /// - Returns: Nothing. - func addViews() - - /// Method for cofiguring appearance of views. - /// - /// - Returns: Nothing. - func configureAppearance() - - /// Method for cofiguring layout and layout properties. - /// - /// - Returns: Nothing. - func configureLayout() - - /// Method is called during layout calls. - /// - /// - Returns: Nothing. - func layout() - - /// Method for calculating best-fitting cell size. - /// - /// - Parameter containerSize: The size for which the view should calculate its best-fitting size. - /// - Returns: Best-fitting size. - func layout(with containerSize: CGSize) -> CGSize - - /// Current content height. - var contentHeight: CGFloat { get } -} diff --git a/Sources/Services/BiometricsService.swift b/Sources/Services/BiometricsService.swift index 029e1ea..7bec607 100644 --- a/Sources/Services/BiometricsService.swift +++ b/Sources/Services/BiometricsService.swift @@ -66,6 +66,9 @@ public final class BiometricsService { case .none: return .none + + @unknown default: + return .none } }