From e3c762d168d8257f79d6b78be81e73dc170fec32 Mon Sep 17 00:00:00 2001 From: Josh Sklar Date: Wed, 15 Jun 2016 13:07:43 -0400 Subject: [PATCH] add associated value to allow cancellation --- PasscodeLock/PasscodeLockPresenter.swift | 2 +- PasscodeLock/PasscodeLockViewController.swift | 4 ++-- PasscodeLockDemo/CustomPasscodeLockPresenter.swift | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PasscodeLock/PasscodeLockPresenter.swift b/PasscodeLock/PasscodeLockPresenter.swift index 7f1f619d..69775d5c 100644 --- a/PasscodeLock/PasscodeLockPresenter.swift +++ b/PasscodeLock/PasscodeLockPresenter.swift @@ -37,7 +37,7 @@ public class PasscodeLockPresenter { } public convenience init(mainWindow window: UIWindow?, configuration: PasscodeLockConfigurationType) { - let passcodeLockVC = PasscodeLockViewController(state: .EnterPasscode, configuration: configuration) + let passcodeLockVC = PasscodeLockViewController(state: .EnterPasscode(allowCancellation: true), configuration: configuration) self.init(mainWindow: window, configuration: configuration, viewController: passcodeLockVC) } diff --git a/PasscodeLock/PasscodeLockViewController.swift b/PasscodeLock/PasscodeLockViewController.swift index 6fb0887f..933d0637 100644 --- a/PasscodeLock/PasscodeLockViewController.swift +++ b/PasscodeLock/PasscodeLockViewController.swift @@ -11,7 +11,7 @@ import UIKit public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDelegate { public enum LockState { - case EnterPasscode + case EnterPasscode(allowCancellation: Bool) case SetPasscode case ChangePasscode case RemovePasscode @@ -19,7 +19,7 @@ public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDeleg func getState() -> PasscodeLockStateType { switch self { - case .EnterPasscode: return EnterPasscodeState() + case .EnterPasscode(let allowCancellation): return EnterPasscodeState(allowCancellation: allowCancellation) case .SetPasscode: return SetPasscodeState() case .ChangePasscode: return ChangePasscodeState() case .RemovePasscode: return EnterPasscodeState(allowCancellation: true) diff --git a/PasscodeLockDemo/CustomPasscodeLockPresenter.swift b/PasscodeLockDemo/CustomPasscodeLockPresenter.swift index 04914a00..242c5f68 100644 --- a/PasscodeLockDemo/CustomPasscodeLockPresenter.swift +++ b/PasscodeLockDemo/CustomPasscodeLockPresenter.swift @@ -24,7 +24,7 @@ class CustomPasscodeLockPresenter: PasscodeLockPresenter { splashView = LockSplashView() // TIP: you can set your custom viewController that has added functionality in a custom .xib too - let passcodeLockVC = PasscodeLockViewController(state: .EnterPasscode, configuration: configuration) + let passcodeLockVC = PasscodeLockViewController(state: .EnterPasscode(allowCancellation: true), configuration: configuration) super.init(mainWindow: window, configuration: configuration, viewController: passcodeLockVC)