diff --git a/CHANGELOG.md b/CHANGELOG.md index 31b45f2..55d08f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### 0.3.11 +- **Add**: Carthage support. +- **[Breaking change]**: Remove `BaseDateFormatter`. Use `NumberFormattingService` from LeadKit instead. + ### 0.3.10 - **[Breaking change]**: Remove `isTouchIdSupported` and `isFaceIdSupported`. diff --git a/LeadKitAdditions.podspec b/LeadKitAdditions.podspec index f1b086a..ebd5295 100644 --- a/LeadKitAdditions.podspec +++ b/LeadKitAdditions.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKitAdditions" - s.version = "0.3.10" + s.version = "0.3.11" s.summary = "iOS framework with a bunch of tools for rapid development" s.homepage = "https://github.com/TouchInstinct/LeadKitAdditions" s.license = "Apache License, Version 2.0" @@ -12,10 +12,6 @@ Pod::Spec.new do |s| ss.ios.deployment_target = '9.0' ss.source_files = "Sources/**/*.swift" - ss.exclude_files = [ - "Sources/Services/Network/DefaultNetworkService+ActivityIndicator+Extension.swift", - ] - ss.dependency "LeadKit", '~> 0.9.0' ss.dependency "KeychainAccess", '3.1.0' ss.dependency "CryptoSwift", '~> 0.9.0' @@ -23,24 +19,6 @@ Pod::Spec.new do |s| ss.dependency "PinLayout", '~> 1.6' end - s.subspec 'Core-iOS-Extension' do |ss| - ss.platform = :ios, '9.0' - ss.source_files = "Sources/**/*.swift" - - ss.exclude_files = [ - "Sources/Classes/Cells/LabelTableViewCell/*.swift", - "Sources/Services/Network/DefaultNetworkService+ActivityIndicator.swift", - "Sources/Extensions/Cells/**/*.swift", - "Sources/Controllers/Passcode/**/*.swift" - ] - - ss.dependency "LeadKit/Core-iOS-Extension", '~> 0.9.0' - ss.dependency "KeychainAccess", '3.1.0' - ss.dependency "CryptoSwift", '~> 0.9.0' - ss.dependency "SwiftValidator", '4.0.2' - ss.dependency "PinLayout", '~> 1.6' - end - s.default_subspec = 'Core' end diff --git a/LeadKitAdditions.xcodeproj/project.pbxproj b/LeadKitAdditions.xcodeproj/project.pbxproj index 1328f1b..03019c6 100644 --- a/LeadKitAdditions.xcodeproj/project.pbxproj +++ b/LeadKitAdditions.xcodeproj/project.pbxproj @@ -35,7 +35,6 @@ 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, ); }; }; - ED0C34051F2906EC00FAE9FD /* BaseDateFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED0C33D41F2906EC00FAE9FD /* BaseDateFormatter.swift */; }; ED0C34071F2906EC00FAE9FD /* LoadingBarButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED0C33D51F2906EC00FAE9FD /* LoadingBarButton.swift */; }; ED0C34091F2906EC00FAE9FD /* PassCodeConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED0C33D91F2906EC00FAE9FD /* PassCodeConfiguration.swift */; }; ED0C340B1F2906EC00FAE9FD /* PassCodeError.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED0C33DA1F2906EC00FAE9FD /* PassCodeError.swift */; }; @@ -85,7 +84,6 @@ A6CFB8D81F5024A500A42CC2 /* Error+NetworkingExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Error+NetworkingExtensions.swift"; sourceTree = ""; }; CAE698E31E968820000394B0 /* LeadKitAdditions.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LeadKitAdditions.framework; sourceTree = BUILT_PRODUCTS_DIR; }; CAE698E61E968820000394B0 /* LeadKitAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LeadKitAdditions.h; sourceTree = ""; }; - ED0C33D41F2906EC00FAE9FD /* BaseDateFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseDateFormatter.swift; sourceTree = ""; }; ED0C33D51F2906EC00FAE9FD /* LoadingBarButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingBarButton.swift; sourceTree = ""; }; ED0C33D91F2906EC00FAE9FD /* PassCodeConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PassCodeConfiguration.swift; sourceTree = ""; }; ED0C33DA1F2906EC00FAE9FD /* PassCodeError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PassCodeError.swift; sourceTree = ""; }; @@ -240,7 +238,6 @@ children = ( 67528BCB206E3C12009F2525 /* Cells */, 67B4E6F0206945D200E233EA /* BaseTextFieldViewModel */, - ED0C33D41F2906EC00FAE9FD /* BaseDateFormatter.swift */, ED0C33D51F2906EC00FAE9FD /* LoadingBarButton.swift */, ); path = Classes; @@ -426,7 +423,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "swiftlint autocorrect --path Sources --config ${PROJECT_DIR}/build-scripts/xcode/.swiftlint.yml && swiftlint --path Sources --config ${PROJECT_DIR}/build-scripts/xcode/.swiftlint.yml\n"; + shellScript = "CONFIG_PATH=${PROJECT_DIR}/build-scripts/xcode/.swiftlint.yml\n\nif which swiftlint >/dev/null; then\nswiftlint autocorrect --path Sources --config ${CONFIG_PATH} && swiftlint --path Sources --config ${CONFIG_PATH}\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -460,7 +457,6 @@ 6760AF1A207268EC00C2BB7E /* PinLayoutCell+DefaultImplementation.swift in Sources */, ED0C34211F2906EC00FAE9FD /* UserDefaults+UserService.swift in Sources */, ED0C34111F2906EC00FAE9FD /* PassCodeValidationResult.swift in Sources */, - ED0C34051F2906EC00FAE9FD /* BaseDateFormatter.swift in Sources */, ED0C34431F2906EC00FAE9FD /* ValidationService.swift in Sources */, ED0C340B1F2906EC00FAE9FD /* PassCodeError.swift in Sources */, 67B4E6F6206945DD00E233EA /* OnlineValidationResult.swift in Sources */, diff --git a/Sources/Classes/BaseDateFormatter.swift b/Sources/Classes/BaseDateFormatter.swift deleted file mode 100644 index 3217355..0000000 --- a/Sources/Classes/BaseDateFormatter.swift +++ /dev/null @@ -1,107 +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 - -/// Base date formatter class, contains most frequently used formats, including RFC3339 -open class BaseDateFormatter { - - private static let apiDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssZ" - private static let apiDateWithoutTimeFormat = "yyyy-MM-dd'T'Z" - private static let hourAndMinuteDateTimeFormat = "HH:mm" - private static let dayAndMonthDateTimeFormat = "dd MMM" - private static let dayMonthYearDateTimeFormat = "dd.MM.yyyy" - - private static let apiFormatter: DateFormatter = { - let dateFormatter = DateFormatter() - dateFormatter.dateFormat = apiDateTimeFormat - return dateFormatter - }() - - private static let apiDateWithoutTimeFormatter: DateFormatter = { - let dateFormatter = DateFormatter() - dateFormatter.dateFormat = apiDateWithoutTimeFormat - return dateFormatter - }() - - private static let hourAndMinuteFormatter: DateFormatter = { - let dateFormater = DateFormatter() - dateFormater.dateFormat = hourAndMinuteDateTimeFormat - return dateFormater - }() - - private static let dayAndMonthFormatter: DateFormatter = { - let dateFormater = DateFormatter() - dateFormater.dateFormat = dayAndMonthDateTimeFormat - return dateFormater - }() - - private static let dayMonthYearFormatter: DateFormatter = { - let dateFormater = DateFormatter() - dateFormater.dateFormat = dayMonthYearDateTimeFormat - return dateFormater - }() - - // MARK: - Public interface - - /// DateFormatter's locale can be overriden - open class var usedLocale: Locale { - return .current - } - - /// Parse date from string with format: yyyy-MM-dd'T'HH:mm:ssZ - public static func backendDate(fromStrDate strDate: String) -> Date? { - apiFormatter.locale = usedLocale - return apiFormatter.date(from: strDate) - } - - /// Serialize date into string with format: yyyy-MM-dd'T'HH:mm:ssZ - public static func backendStrDate(withDate date: Date) -> String { - apiFormatter.locale = usedLocale - return apiFormatter.string(from: date) - } - - /// Serialize date into string with format: yyyy-MM-dd'T'Z - public static func backendDateWithoutTime(withDate date: Date) -> String { - apiDateWithoutTimeFormatter.locale = usedLocale - return apiDateWithoutTimeFormatter.string(from: date) - } - - /// Serialize date into string with format: HH:mm - public static func hourAndMinuteStrDate(withDate date: Date) -> String { - hourAndMinuteFormatter.locale = usedLocale - return hourAndMinuteFormatter.string(from: date) - } - - /// Serialize date into string with format: dd MMM - public static func dayAndMonthStrDate(withDate date: Date) -> String { - hourAndMinuteFormatter.locale = usedLocale - return dayAndMonthFormatter.string(from: date) - } - - /// Serialize date into string with format: dd.MM.yyyy - public static func dayMonthYearStrDate(withDate date: Date) -> String { - hourAndMinuteFormatter.locale = usedLocale - return dayMonthYearFormatter.string(from: date) - } - -} diff --git a/Sources/Classes/BaseTextFieldViewModel/BaseTextFieldViewModel.swift b/Sources/Classes/BaseTextFieldViewModel/BaseTextFieldViewModel.swift index 3255c16..9e1b0e4 100644 --- a/Sources/Classes/BaseTextFieldViewModel/BaseTextFieldViewModel.swift +++ b/Sources/Classes/BaseTextFieldViewModel/BaseTextFieldViewModel.swift @@ -36,7 +36,6 @@ open class BaseTextFieldViewEvents: TextFieldViewEvents { public init(textChangedDriver: Driver) { self.textChangedDriver = textChangedDriver } - } /// Base implementation of text field view model events. @@ -60,7 +59,6 @@ open class BaseTextFieldViewModelEvents: TextFieldViewModelEvents { self.changeValidationStateDriver = changeValidationStateDriver self.changeOnlineValidationStateDriver = changeOnlineValidationStateDriver } - } public extension BaseTextFieldViewModelEvents { @@ -164,5 +162,4 @@ public extension BaseTextFieldViewModelEvents { changeValidationStateDriver: offlineValidationDriver, changeOnlineValidationStateDriver: onlineValidationDriver) } - } diff --git a/Sources/Classes/Cells/LabelTableViewCell/LabelCellViewModel.swift b/Sources/Classes/Cells/LabelTableViewCell/LabelCellViewModel.swift index 8451897..5ae28e1 100644 --- a/Sources/Classes/Cells/LabelTableViewCell/LabelCellViewModel.swift +++ b/Sources/Classes/Cells/LabelTableViewCell/LabelCellViewModel.swift @@ -52,5 +52,4 @@ open class LabelCellViewModel { self.labelInsets = labelInsets self.separatorType = separatorType } - } diff --git a/Sources/Classes/Cells/LabelTableViewCell/LabelTableViewCell.swift b/Sources/Classes/Cells/LabelTableViewCell/LabelTableViewCell.swift index 2337c7d..026820b 100644 --- a/Sources/Classes/Cells/LabelTableViewCell/LabelTableViewCell.swift +++ b/Sources/Classes/Cells/LabelTableViewCell/LabelTableViewCell.swift @@ -38,8 +38,7 @@ open class LabelTableViewCell: SeparatorTableViewCell { override open func addViews() { super.addViews() - contentContainerView.addSubview(backgroundImageView) - contentContainerView.addSubview(label) + contentContainerView.addSubviews(backgroundImageView, label) contentView.addSubview(contentContainerView) } @@ -137,5 +136,4 @@ open class LabelTableViewCell: SeparatorTableViewCell { public func configureLabelText(with viewText: ViewText) { label.configure(with: viewText) } - } diff --git a/Sources/Classes/Cells/PinLayoutTableViewCell.swift b/Sources/Classes/Cells/PinLayoutTableViewCell.swift index a43c20b..20f9b6b 100644 --- a/Sources/Classes/Cells/PinLayoutTableViewCell.swift +++ b/Sources/Classes/Cells/PinLayoutTableViewCell.swift @@ -90,7 +90,6 @@ open class PinLayoutTableViewCell: UITableViewCell, PinLayoutCell { open var contentHeight: CGFloat { return contentView.subviewsMaxY } - } private extension UIView { @@ -100,5 +99,4 @@ private extension UIView { .map { $0.frame.maxY } .max() ?? frame.maxY } - } diff --git a/Sources/Classes/Cells/SeparatorTableViewCell.swift b/Sources/Classes/Cells/SeparatorTableViewCell.swift index 8edd9ee..3d74525 100644 --- a/Sources/Classes/Cells/SeparatorTableViewCell.swift +++ b/Sources/Classes/Cells/SeparatorTableViewCell.swift @@ -60,8 +60,7 @@ open class SeparatorTableViewCell: PinLayoutTableViewCell { override open func addViews() { super.addViews() - contentView.addSubview(topSeparator) - contentView.addSubview(bottomSeparator) + contentView.addSubviews(topSeparator, bottomSeparator) } override open func layout() { @@ -100,5 +99,4 @@ open class SeparatorTableViewCell: PinLayoutTableViewCell { configureSeparator(with: .none) } - } diff --git a/Sources/Classes/LoadingBarButton.swift b/Sources/Classes/LoadingBarButton.swift index 358b011..780140f 100644 --- a/Sources/Classes/LoadingBarButton.swift +++ b/Sources/Classes/LoadingBarButton.swift @@ -42,6 +42,7 @@ public class LoadingBarButton { switch side { case .left: return navigationItem?.leftBarButtonItem + case .right: return navigationItem?.rightBarButtonItem } @@ -50,6 +51,7 @@ public class LoadingBarButton { switch side { case .left: navigationItem?.leftBarButtonItem = newValue + case .right: navigationItem?.rightBarButtonItem = newValue } @@ -71,14 +73,13 @@ public class LoadingBarButton { fileprivate func setState(waiting: Bool = false) { if waiting { - let activityIndicatorItem = UIBarButtonItem.activityIndicator + let activityIndicatorItem = UIBarButtonItem.activityIndicator barButtonItem = activityIndicatorItem.barButton activityIndicatorItem.activityIndicator.startAnimating() } else { barButtonItem = initialBarButton } } - } public extension Observable { @@ -100,5 +101,4 @@ public extension Observable { barButton.setState(waiting: false) }) } - } diff --git a/Sources/Controllers/PassCode/Model/PassCodeDelayedDescription.swift b/Sources/Controllers/PassCode/Model/PassCodeDelayedDescription.swift index 44f17f9..5acf800 100644 --- a/Sources/Controllers/PassCode/Model/PassCodeDelayedDescription.swift +++ b/Sources/Controllers/PassCode/Model/PassCodeDelayedDescription.swift @@ -32,5 +32,4 @@ public struct PassCodeDelayedDescription { self.description = description self.delay = delay } - } diff --git a/Sources/Controllers/PassCode/Model/PassCodeError.swift b/Sources/Controllers/PassCode/Model/PassCodeError.swift index 6e2a86b..ed688db 100644 --- a/Sources/Controllers/PassCode/Model/PassCodeError.swift +++ b/Sources/Controllers/PassCode/Model/PassCodeError.swift @@ -37,6 +37,7 @@ public extension PassCodeError { switch self { case .tooManyAttempts: return true + default: return false } diff --git a/Sources/Controllers/PassCode/Model/PassCodeHolder.swift b/Sources/Controllers/PassCode/Model/PassCodeHolder.swift index 874bd7a..21d9201 100644 --- a/Sources/Controllers/PassCode/Model/PassCodeHolder.swift +++ b/Sources/Controllers/PassCode/Model/PassCodeHolder.swift @@ -70,8 +70,10 @@ public class PassCodeHolderCreate: PassCodeHolderProtocol { switch enterStep { case .enter: firstPassCode = passCode + case .repeatEnter: secondPassCode = passCode + default: break } @@ -86,10 +88,9 @@ public class PassCodeHolderCreate: PassCodeHolderProtocol { } public func reset() { - firstPassCode = nil + firstPassCode = nil secondPassCode = nil } - } /// Holds information about pass code during pass code entering process @@ -119,7 +120,6 @@ public class PassCodeHolderEnter: PassCodeHolderProtocol { public func reset() { passCode = nil } - } /// Holds information about pass codes during pass code changing process @@ -155,10 +155,13 @@ public class PassCodeHolderChange: PassCodeHolderProtocol { switch (oldPassCode, newFirstPassCode, newSecondPassCode) { case (let oldPassCode?, nil, nil): return oldPassCode + case (_, _?, nil): return nil - case (_, let newFirstPassCode?, let newSecondPassCode?) where newFirstPassCode == newSecondPassCode: + + case let (_, newFirstPassCode?, newSecondPassCode?) where newFirstPassCode == newSecondPassCode: return newFirstPassCode + default: return nil } @@ -190,5 +193,4 @@ public class PassCodeHolderChange: PassCodeHolderProtocol { newSecondPassCode = nil } } - } diff --git a/Sources/Controllers/PassCode/Model/PassCodeHolderProtocol.swift b/Sources/Controllers/PassCode/Model/PassCodeHolderProtocol.swift index 0537f08..ead1c49 100644 --- a/Sources/Controllers/PassCode/Model/PassCodeHolderProtocol.swift +++ b/Sources/Controllers/PassCode/Model/PassCodeHolderProtocol.swift @@ -41,7 +41,6 @@ public protocol PassCodeHolderProtocol { /// Returns passCode or error if pass code is invalid func validate() -> PassCodeValidationResult - } public class PassCodeHolderBuilder { @@ -58,11 +57,12 @@ public class PassCodeHolderBuilder { switch type { case .create: return PassCodeHolderCreate() + case .enter: return PassCodeHolderEnter() + case .change: return PassCodeHolderChange() } } - } diff --git a/Sources/Controllers/PassCode/Model/PassCodeValidationResult.swift b/Sources/Controllers/PassCode/Model/PassCodeValidationResult.swift index f918a6d..9609386 100644 --- a/Sources/Controllers/PassCode/Model/PassCodeValidationResult.swift +++ b/Sources/Controllers/PassCode/Model/PassCodeValidationResult.swift @@ -25,7 +25,6 @@ public enum PassCodeValidationResult { case valid(String) case invalid(PassCodeError?) - } public extension PassCodeValidationResult { @@ -33,6 +32,7 @@ public extension PassCodeValidationResult { switch self { case .valid: return true + case .invalid: return false } @@ -42,6 +42,7 @@ public extension PassCodeValidationResult { switch self { case let .valid(passCode): return passCode + case .invalid: return nil } @@ -51,6 +52,7 @@ public extension PassCodeValidationResult { switch self { case let .invalid(error): return error + case .valid: return nil } diff --git a/Sources/Controllers/PassCode/View/BasePassCodeViewController.swift b/Sources/Controllers/PassCode/View/BasePassCodeViewController.swift index 81378fe..e4aa96b 100644 --- a/Sources/Controllers/PassCode/View/BasePassCodeViewController.swift +++ b/Sources/Controllers/PassCode/View/BasePassCodeViewController.swift @@ -49,7 +49,7 @@ public enum PassCodeControllerState { /// Base view controller that operates with pass code open class BasePassCodeViewController: UIViewController, LegacyConfigurableController { - public var viewModel: BasePassCodeViewModel! + public var viewModel: BasePassCodeViewModel! // swiftlint:disable:this implicitly_unwrapped_optional // MARK: - IBOutlets @@ -294,7 +294,6 @@ open class BasePassCodeViewController: UIViewController, LegacyConfigurableContr open func configureBarButtons() {} open func localize() {} - } // MARK: - UITextFieldDelegate @@ -308,5 +307,4 @@ extension BasePassCodeViewController: UITextFieldDelegate { let invalid = CharacterSet(charactersIn: "0123456789").inverted return string.rangeOfCharacter(from: invalid, options: [], range: string.startIndex.. Void /// Service that provide access to authentication via biometric public final class BiometricsService { - + public enum BiometryType { - + case faceID - + case touchID - + case none } @@ -55,18 +55,20 @@ public final class BiometricsService { /// Returns BiometryType supporting by device: TouchID, FaceID or none public var biometryType: BiometryType { let canEvaluate = canAuthenticateWithBiometrics - + if #available(iOS 11.0, *) { switch laContext.biometryType { case .touchID: return .touchID + case .faceID: return .faceID + case .none: return .none } } - + return canEvaluate ? .touchID : .none } diff --git a/Sources/Services/ValidationService/OnlineValidationState.swift b/Sources/Services/ValidationService/OnlineValidationState.swift index fd94af0..2679960 100644 --- a/Sources/Services/ValidationService/OnlineValidationState.swift +++ b/Sources/Services/ValidationService/OnlineValidationState.swift @@ -32,5 +32,4 @@ public enum OnlineValidationState { case processing case valid case invalid(error: Error?) - } diff --git a/Sources/Services/ValidationService/ValidationError.swift b/Sources/Services/ValidationService/ValidationError.swift index d230c35..09eccba 100644 --- a/Sources/Services/ValidationService/ValidationError.swift +++ b/Sources/Services/ValidationService/ValidationError.swift @@ -11,5 +11,4 @@ public struct ValidationError: Error { self.errorMessage = errorMessage self.errorHint = errorHint } - } diff --git a/Sources/Services/ValidationService/ValidationItem.swift b/Sources/Services/ValidationService/ValidationItem.swift index 934c2b5..54e160d 100644 --- a/Sources/Services/ValidationService/ValidationItem.swift +++ b/Sources/Services/ValidationService/ValidationItem.swift @@ -15,6 +15,7 @@ public extension ValidationItemState { switch self { case .initial: return true + default: return false } @@ -24,11 +25,11 @@ public extension ValidationItemState { switch self { case .valid: return true + default: return false } } - } public final class ValidationItem { @@ -58,7 +59,8 @@ public final class ValidationItem { .drive(text) .disposed(by: disposeBag) - textDriver.asObservable().withLatestFrom(validationStateHolder.asObservable()) { (text: $0, validationState: $1) } + textDriver.asObservable() + .withLatestFrom(validationStateHolder.asObservable()) { (text: $0, validationState: $1) } .filter { !$0.validationState.isInitial } .map { $0.text } .subscribe(onNext: { [weak self] text in @@ -89,6 +91,7 @@ public final class ValidationItem { .valid where !isManual: validationStateHolder.value = .correction(validationError) + default: validationStateHolder.value = .error(validationError) } @@ -96,5 +99,4 @@ public final class ValidationItem { validationStateHolder.value = .valid } } - } diff --git a/Sources/Services/ValidationService/ValidationService.swift b/Sources/Services/ValidationService/ValidationService.swift index b2c7845..8301396 100644 --- a/Sources/Services/ValidationService/ValidationService.swift +++ b/Sources/Services/ValidationService/ValidationService.swift @@ -19,7 +19,6 @@ public extension ValidationServiceState { var isValid: Bool { return self == .valid } - } public final class ValidationService { @@ -103,5 +102,4 @@ public final class ValidationService { .disposed(by: disposeBag) } } - } diff --git a/build-scripts b/build-scripts index ea12763..54935bb 160000 --- a/build-scripts +++ b/build-scripts @@ -1 +1 @@ -Subproject commit ea127636275ceea8abcf3ec9aa62ffe6d13f0b72 +Subproject commit 54935bbe26063cdf04e72b8cb76d61c727ff99a7