diff --git a/LeadKitAdditions/Sources/Classes/ApiResponse.swift b/LeadKitAdditions/Sources/Classes/ApiResponse.swift index 98773b5..6a98860 100644 --- a/LeadKitAdditions/Sources/Classes/ApiResponse.swift +++ b/LeadKitAdditions/Sources/Classes/ApiResponse.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Classes/BaseDateFormatter.swift b/LeadKitAdditions/Sources/Classes/BaseDateFormatter.swift index 3bdf9ae..cec812c 100644 --- a/LeadKitAdditions/Sources/Classes/BaseDateFormatter.swift +++ b/LeadKitAdditions/Sources/Classes/BaseDateFormatter.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Classes/LoadingBarButton.swift b/LeadKitAdditions/Sources/Classes/LoadingBarButton.swift index 2d7a7a9..5db8b52 100644 --- a/LeadKitAdditions/Sources/Classes/LoadingBarButton.swift +++ b/LeadKitAdditions/Sources/Classes/LoadingBarButton.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeConfiguration.swift b/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeConfiguration.swift index a8b5931..4d9bc18 100644 --- a/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeConfiguration.swift +++ b/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeConfiguration.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeError.swift b/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeError.swift index 6e766af..64b3de4 100644 --- a/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeError.swift +++ b/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeError.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeHolder.swift b/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeHolder.swift index 4dae8fc..aac5919 100644 --- a/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeHolder.swift +++ b/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeHolder.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 @@ -81,7 +81,7 @@ public class PassCodeHolderCreate: PassCodeHolderProtocol { if let passCode = passCode { return .valid(passCode) } else { - return .inValid(.codesNotMatch) + return .invalid(.codesNotMatch) } } @@ -112,7 +112,7 @@ public class PassCodeHolderEnter: PassCodeHolderProtocol { if let passCode = passCode { return .valid(passCode) } else { - return .inValid(nil) + return .invalid(nil) } } @@ -178,7 +178,7 @@ public class PassCodeHolderChange: PassCodeHolderProtocol { if let passCode = passCode { return .valid(passCode) } else { - return .inValid(enterStep == .newEnter ? nil : .codesNotMatch) + return .invalid(enterStep == .newEnter ? nil : .codesNotMatch) } } diff --git a/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeHolderProtocol.swift b/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeHolderProtocol.swift index b4a031d..d8bcf6c 100644 --- a/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeHolderProtocol.swift +++ b/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeHolderProtocol.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeValidationResult.swift b/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeValidationResult.swift index 41bdbd1..1cede03 100644 --- a/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeValidationResult.swift +++ b/LeadKitAdditions/Sources/Controllers/PassCode/Model/PassCodeValidationResult.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 @@ -24,33 +24,35 @@ public enum PassCodeValidationResult { case valid(String) - case inValid(PassCodeError?) + case invalid(PassCodeError?) - public var isValid: Bool { +} + +public extension PassCodeValidationResult { + var isValid: Bool { switch self { case .valid: return true - default: + case .invalid(_): return false } } - public var passCode: String? { + var passCode: String? { switch self { case let .valid(passCode): return passCode - default: + case .invalid(_): return nil } } - public var error: PassCodeError? { + var error: PassCodeError? { switch self { - case let .inValid(error): + case let .invalid(error): return error - default: + case .valid(_): return nil } } - } diff --git a/LeadKitAdditions/Sources/Controllers/PassCode/ViewModel/BasePassCodeViewModel.swift b/LeadKitAdditions/Sources/Controllers/PassCode/ViewModel/BasePassCodeViewModel.swift index b024f41..2e4245a 100644 --- a/LeadKitAdditions/Sources/Controllers/PassCode/ViewModel/BasePassCodeViewModel.swift +++ b/LeadKitAdditions/Sources/Controllers/PassCode/ViewModel/BasePassCodeViewModel.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 @@ -180,12 +180,12 @@ extension BasePassCodeViewModel { attemptsNumber += 1 if let passCode = validationResult.passCode, !isEnteredPassCodeValid(passCode) { - validationResult = .inValid(.wrongCode) + validationResult = .invalid(.wrongCode) } if (!validationResult.isValid && attemptsNumber == Int(passCodeConfiguration.maxAttemptsNumber)) || attemptsNumber > Int(passCodeConfiguration.maxAttemptsNumber) { - validationResult = .inValid(.tooManyAttempts) + validationResult = .invalid(.tooManyAttempts) } } diff --git a/LeadKitAdditions/Sources/Enums/ApiError.swift b/LeadKitAdditions/Sources/Enums/ApiError.swift index bb4533e..aff43d1 100644 --- a/LeadKitAdditions/Sources/Enums/ApiError.swift +++ b/LeadKitAdditions/Sources/Enums/ApiError.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Enums/ApiErrorProtocol.swift b/LeadKitAdditions/Sources/Enums/ApiErrorProtocol.swift index 31b0113..f94a9a8 100644 --- a/LeadKitAdditions/Sources/Enums/ApiErrorProtocol.swift +++ b/LeadKitAdditions/Sources/Enums/ApiErrorProtocol.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Extensions/Observable+Extensions.swift b/LeadKitAdditions/Sources/Extensions/Observable+Extensions.swift index c6dbe09..c854ee9 100644 --- a/LeadKitAdditions/Sources/Extensions/Observable+Extensions.swift +++ b/LeadKitAdditions/Sources/Extensions/Observable+Extensions.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Extensions/UIBarButtonItem+Extensions.swift b/LeadKitAdditions/Sources/Extensions/UIBarButtonItem+Extensions.swift index ef3eaf7..f237bf2 100644 --- a/LeadKitAdditions/Sources/Extensions/UIBarButtonItem+Extensions.swift +++ b/LeadKitAdditions/Sources/Extensions/UIBarButtonItem+Extensions.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Extensions/UserDefaults+UserService.swift b/LeadKitAdditions/Sources/Extensions/UserDefaults+UserService.swift index 6ca694f..39ffd95 100644 --- a/LeadKitAdditions/Sources/Extensions/UserDefaults+UserService.swift +++ b/LeadKitAdditions/Sources/Extensions/UserDefaults+UserService.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Services/BasePassCodeService.swift b/LeadKitAdditions/Sources/Services/BasePassCodeService.swift index 53ce561..a7a9c67 100644 --- a/LeadKitAdditions/Sources/Services/BasePassCodeService.swift +++ b/LeadKitAdditions/Sources/Services/BasePassCodeService.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Services/BaseUserService.swift b/LeadKitAdditions/Sources/Services/BaseUserService.swift index 016b749..2fa1606 100644 --- a/LeadKitAdditions/Sources/Services/BaseUserService.swift +++ b/LeadKitAdditions/Sources/Services/BaseUserService.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Services/Network/ApiNetworkService.swift b/LeadKitAdditions/Sources/Services/Network/ApiNetworkService.swift index 2293906..f30065f 100644 --- a/LeadKitAdditions/Sources/Services/Network/ApiNetworkService.swift +++ b/LeadKitAdditions/Sources/Services/Network/ApiNetworkService.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Services/Network/DefaultNetworkService+ActivityIndicator.swift b/LeadKitAdditions/Sources/Services/Network/DefaultNetworkService+ActivityIndicator.swift index abe2e32..28f5aa1 100644 --- a/LeadKitAdditions/Sources/Services/Network/DefaultNetworkService+ActivityIndicator.swift +++ b/LeadKitAdditions/Sources/Services/Network/DefaultNetworkService+ActivityIndicator.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Services/Network/DefaultNetworkService.swift b/LeadKitAdditions/Sources/Services/Network/DefaultNetworkService.swift index 54d8c2f..b64d9c0 100644 --- a/LeadKitAdditions/Sources/Services/Network/DefaultNetworkService.swift +++ b/LeadKitAdditions/Sources/Services/Network/DefaultNetworkService.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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 diff --git a/LeadKitAdditions/Sources/Services/TouchIDService.swift b/LeadKitAdditions/Sources/Services/TouchIDService.swift index 4dfaab2..69e6325 100644 --- a/LeadKitAdditions/Sources/Services/TouchIDService.swift +++ b/LeadKitAdditions/Sources/Services/TouchIDService.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// 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