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)