From e67e0e9d45b0c826c60ab4e845646e1bfb8686ab Mon Sep 17 00:00:00 2001 From: Ali Zahedi Date: Tue, 10 Jan 2017 20:06:11 +0330 Subject: [PATCH 1/5] Swift 3 --- PasscodeLock.xcodeproj/project.pbxproj | 93 +++++++------ PasscodeLock/Functions.swift | 10 +- .../PasscodeLock/ChangePasscodeState.swift | 2 +- .../PasscodeLock/ConfirmPasscodeState.swift | 4 +- .../PasscodeLock/EnterPasscodeState.swift | 12 +- PasscodeLock/PasscodeLock/PasscodeLock.swift | 36 ++--- .../PasscodeLock/SetPasscodeState.swift | 2 +- PasscodeLock/PasscodeLockPresenter.swift | 30 ++-- PasscodeLock/PasscodeLockViewController.swift | 130 +++++++++--------- .../Protocols/PasscodeLockStateType.swift | 2 +- PasscodeLock/Protocols/PasscodeLockType.swift | 14 +- .../Protocols/PasscodeRepositoryType.swift | 2 +- PasscodeLock/Views/PasscodeSignButton.swift | 34 ++--- .../Views/PasscodeSignPlaceholderView.swift | 38 ++--- PasscodeLockDemo/Base.lproj/Main.storyboard | 37 ++--- .../Fakes/FakePasscodeLock.swift | 4 +- .../Fakes/FakePasscodeLockDelegate.swift | 10 +- .../Fakes/FakePasscodeRepository.swift | 2 +- .../Fakes/FakePasscodeState.swift | 2 +- .../ChangePasscodeStateTests.swift | 4 +- .../ConfirmPasscodeStateTests.swift | 6 +- .../EnterPasscodeStateTests.swift | 12 +- .../PasscodeLock/PasscodeLockTests.swift | 6 +- .../PasscodeLock/SetPasscodeStateTests.swift | 2 +- 24 files changed, 254 insertions(+), 240 deletions(-) diff --git a/PasscodeLock.xcodeproj/project.pbxproj b/PasscodeLock.xcodeproj/project.pbxproj index 0849b504..1be9e97d 100644 --- a/PasscodeLock.xcodeproj/project.pbxproj +++ b/PasscodeLock.xcodeproj/project.pbxproj @@ -8,8 +8,8 @@ /* Begin PBXBuildFile section */ C99EAF431B90B05700D61E1B /* PasscodeLock.h in Headers */ = {isa = PBXBuildFile; fileRef = C99EAF421B90B05700D61E1B /* PasscodeLock.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C99EAF4A1B90B05800D61E1B /* PasscodeLock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C99EAF3F1B90B05700D61E1B /* PasscodeLock.framework */; settings = {ASSET_TAGS = (); }; }; - C9D3DF0B1B919CE4008561EB /* PasscodeLockView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C9D3DF0A1B919CE4008561EB /* PasscodeLockView.xib */; settings = {ASSET_TAGS = (); }; }; + C99EAF4A1B90B05800D61E1B /* PasscodeLock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C99EAF3F1B90B05700D61E1B /* PasscodeLock.framework */; }; + C9D3DF0B1B919CE4008561EB /* PasscodeLockView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C9D3DF0A1B919CE4008561EB /* PasscodeLockView.xib */; }; C9D3DF131B91AD11008561EB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9D3DF121B91AD11008561EB /* AppDelegate.swift */; }; C9D3DF151B91AD11008561EB /* PasscodeSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9D3DF141B91AD11008561EB /* PasscodeSettingsViewController.swift */; }; C9D3DF181B91AD11008561EB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C9D3DF161B91AD11008561EB /* Main.storyboard */; }; @@ -17,45 +17,45 @@ C9D3DF1D1B91AD11008561EB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C9D3DF1B1B91AD11008561EB /* LaunchScreen.storyboard */; }; C9D3DF3E1B91AD7A008561EB /* PasscodeLock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C99EAF3F1B90B05700D61E1B /* PasscodeLock.framework */; }; C9D3DF3F1B91AD7A008561EB /* PasscodeLock.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C99EAF3F1B90B05700D61E1B /* PasscodeLock.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - C9D3DF441B91B9CD008561EB /* UserDefaultsPasscodeRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9D3DF431B91B9CD008561EB /* UserDefaultsPasscodeRepository.swift */; settings = {ASSET_TAGS = (); }; }; - C9D3DF461B91BD0E008561EB /* PasscodeLockConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9D3DF451B91BD0E008561EB /* PasscodeLockConfiguration.swift */; settings = {ASSET_TAGS = (); }; }; - C9D3DF481B91F099008561EB /* PasscodeLockPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9D3DF471B91F099008561EB /* PasscodeLockPresenter.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07D51B90B1F6007A4DD0 /* PasscodeRepositoryType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07D41B90B1F6007A4DD0 /* PasscodeRepositoryType.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07D61B90B1F6007A4DD0 /* PasscodeRepositoryType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07D41B90B1F6007A4DD0 /* PasscodeRepositoryType.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07D81B90B261007A4DD0 /* PasscodeLockStateType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07D71B90B261007A4DD0 /* PasscodeLockStateType.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07D91B90B261007A4DD0 /* PasscodeLockStateType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07D71B90B261007A4DD0 /* PasscodeLockStateType.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07DB1B90B730007A4DD0 /* PasscodeLockConfigurationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07DA1B90B730007A4DD0 /* PasscodeLockConfigurationType.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07DC1B90B730007A4DD0 /* PasscodeLockConfigurationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07DA1B90B730007A4DD0 /* PasscodeLockConfigurationType.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07DE1B90BA06007A4DD0 /* PasscodeLockType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07DD1B90BA06007A4DD0 /* PasscodeLockType.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07DF1B90BA06007A4DD0 /* PasscodeLockType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07DD1B90BA06007A4DD0 /* PasscodeLockType.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07E11B90BBFD007A4DD0 /* PasscodeLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07E01B90BBFD007A4DD0 /* PasscodeLock.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07E21B90BBFD007A4DD0 /* PasscodeLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07E01B90BBFD007A4DD0 /* PasscodeLock.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07E51B90BCF9007A4DD0 /* PasscodeLockTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07E41B90BCF9007A4DD0 /* PasscodeLockTests.swift */; settings = {ASSET_TAGS = (); }; }; + C9D3DF441B91B9CD008561EB /* UserDefaultsPasscodeRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9D3DF431B91B9CD008561EB /* UserDefaultsPasscodeRepository.swift */; }; + C9D3DF461B91BD0E008561EB /* PasscodeLockConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9D3DF451B91BD0E008561EB /* PasscodeLockConfiguration.swift */; }; + C9D3DF481B91F099008561EB /* PasscodeLockPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9D3DF471B91F099008561EB /* PasscodeLockPresenter.swift */; }; + C9DC07D51B90B1F6007A4DD0 /* PasscodeRepositoryType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07D41B90B1F6007A4DD0 /* PasscodeRepositoryType.swift */; }; + C9DC07D61B90B1F6007A4DD0 /* PasscodeRepositoryType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07D41B90B1F6007A4DD0 /* PasscodeRepositoryType.swift */; }; + C9DC07D81B90B261007A4DD0 /* PasscodeLockStateType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07D71B90B261007A4DD0 /* PasscodeLockStateType.swift */; }; + C9DC07D91B90B261007A4DD0 /* PasscodeLockStateType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07D71B90B261007A4DD0 /* PasscodeLockStateType.swift */; }; + C9DC07DB1B90B730007A4DD0 /* PasscodeLockConfigurationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07DA1B90B730007A4DD0 /* PasscodeLockConfigurationType.swift */; }; + C9DC07DC1B90B730007A4DD0 /* PasscodeLockConfigurationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07DA1B90B730007A4DD0 /* PasscodeLockConfigurationType.swift */; }; + C9DC07DE1B90BA06007A4DD0 /* PasscodeLockType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07DD1B90BA06007A4DD0 /* PasscodeLockType.swift */; }; + C9DC07DF1B90BA06007A4DD0 /* PasscodeLockType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07DD1B90BA06007A4DD0 /* PasscodeLockType.swift */; }; + C9DC07E11B90BBFD007A4DD0 /* PasscodeLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07E01B90BBFD007A4DD0 /* PasscodeLock.swift */; }; + C9DC07E21B90BBFD007A4DD0 /* PasscodeLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07E01B90BBFD007A4DD0 /* PasscodeLock.swift */; }; + C9DC07E51B90BCF9007A4DD0 /* PasscodeLockTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07E41B90BCF9007A4DD0 /* PasscodeLockTests.swift */; }; C9DC07E71B90C382007A4DD0 /* LocalAuthentication.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9DC07E61B90C382007A4DD0 /* LocalAuthentication.framework */; }; - C9DC07EA1B90C690007A4DD0 /* FakePasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07E91B90C690007A4DD0 /* FakePasscodeState.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07EC1B90C72A007A4DD0 /* FakePasscodeRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07EB1B90C72A007A4DD0 /* FakePasscodeRepository.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07EE1B90C7CD007A4DD0 /* FakePasscodeLockConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07ED1B90C7CD007A4DD0 /* FakePasscodeLockConfiguration.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07F01B90C8E1007A4DD0 /* FakePasscodeLockDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07EF1B90C8E1007A4DD0 /* FakePasscodeLockDelegate.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07F21B90C9DE007A4DD0 /* EnterPasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07F11B90C9DE007A4DD0 /* EnterPasscodeState.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07F31B90C9DE007A4DD0 /* EnterPasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07F11B90C9DE007A4DD0 /* EnterPasscodeState.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07F81B90CF29007A4DD0 /* Functions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07F71B90CF29007A4DD0 /* Functions.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07F91B90CF29007A4DD0 /* Functions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07F71B90CF29007A4DD0 /* Functions.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC07FC1B90D0A3007A4DD0 /* PasscodeLock.strings in Resources */ = {isa = PBXBuildFile; fileRef = C9DC07FA1B90D0A3007A4DD0 /* PasscodeLock.strings */; settings = {ASSET_TAGS = (); }; }; - C9DC07FD1B90D0A3007A4DD0 /* PasscodeLock.strings in Resources */ = {isa = PBXBuildFile; fileRef = C9DC07FA1B90D0A3007A4DD0 /* PasscodeLock.strings */; settings = {ASSET_TAGS = (); }; }; - C9DC07FF1B90D24A007A4DD0 /* SetPasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07FE1B90D24A007A4DD0 /* SetPasscodeState.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC08001B90D24A007A4DD0 /* SetPasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07FE1B90D24A007A4DD0 /* SetPasscodeState.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC08021B90D2BA007A4DD0 /* ConfirmPasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08011B90D2BA007A4DD0 /* ConfirmPasscodeState.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC08031B90D2BA007A4DD0 /* ConfirmPasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08011B90D2BA007A4DD0 /* ConfirmPasscodeState.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC08051B90D394007A4DD0 /* ChangePasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08041B90D394007A4DD0 /* ChangePasscodeState.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC08061B90D394007A4DD0 /* ChangePasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08041B90D394007A4DD0 /* ChangePasscodeState.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC08081B90DAE6007A4DD0 /* EnterPasscodeStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08071B90DAE6007A4DD0 /* EnterPasscodeStateTests.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC080A1B90DB09007A4DD0 /* FakePasscodeLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08091B90DB09007A4DD0 /* FakePasscodeLock.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC080C1B90DC38007A4DD0 /* SetPasscodeStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC080B1B90DC38007A4DD0 /* SetPasscodeStateTests.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC080E1B90DC8F007A4DD0 /* ConfirmPasscodeStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC080D1B90DC8F007A4DD0 /* ConfirmPasscodeStateTests.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC08101B90DD91007A4DD0 /* ChangePasscodeStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC080F1B90DD91007A4DD0 /* ChangePasscodeStateTests.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC08121B90DE1B007A4DD0 /* PasscodeSignPlaceholderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08111B90DE1B007A4DD0 /* PasscodeSignPlaceholderView.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC08141B90DE50007A4DD0 /* PasscodeSignButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08131B90DE50007A4DD0 /* PasscodeSignButton.swift */; settings = {ASSET_TAGS = (); }; }; - C9DC08161B90DF4E007A4DD0 /* PasscodeLockViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08151B90DF4E007A4DD0 /* PasscodeLockViewController.swift */; settings = {ASSET_TAGS = (); }; }; + C9DC07EA1B90C690007A4DD0 /* FakePasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07E91B90C690007A4DD0 /* FakePasscodeState.swift */; }; + C9DC07EC1B90C72A007A4DD0 /* FakePasscodeRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07EB1B90C72A007A4DD0 /* FakePasscodeRepository.swift */; }; + C9DC07EE1B90C7CD007A4DD0 /* FakePasscodeLockConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07ED1B90C7CD007A4DD0 /* FakePasscodeLockConfiguration.swift */; }; + C9DC07F01B90C8E1007A4DD0 /* FakePasscodeLockDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07EF1B90C8E1007A4DD0 /* FakePasscodeLockDelegate.swift */; }; + C9DC07F21B90C9DE007A4DD0 /* EnterPasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07F11B90C9DE007A4DD0 /* EnterPasscodeState.swift */; }; + C9DC07F31B90C9DE007A4DD0 /* EnterPasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07F11B90C9DE007A4DD0 /* EnterPasscodeState.swift */; }; + C9DC07F81B90CF29007A4DD0 /* Functions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07F71B90CF29007A4DD0 /* Functions.swift */; }; + C9DC07F91B90CF29007A4DD0 /* Functions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07F71B90CF29007A4DD0 /* Functions.swift */; }; + C9DC07FC1B90D0A3007A4DD0 /* PasscodeLock.strings in Resources */ = {isa = PBXBuildFile; fileRef = C9DC07FA1B90D0A3007A4DD0 /* PasscodeLock.strings */; }; + C9DC07FD1B90D0A3007A4DD0 /* PasscodeLock.strings in Resources */ = {isa = PBXBuildFile; fileRef = C9DC07FA1B90D0A3007A4DD0 /* PasscodeLock.strings */; }; + C9DC07FF1B90D24A007A4DD0 /* SetPasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07FE1B90D24A007A4DD0 /* SetPasscodeState.swift */; }; + C9DC08001B90D24A007A4DD0 /* SetPasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC07FE1B90D24A007A4DD0 /* SetPasscodeState.swift */; }; + C9DC08021B90D2BA007A4DD0 /* ConfirmPasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08011B90D2BA007A4DD0 /* ConfirmPasscodeState.swift */; }; + C9DC08031B90D2BA007A4DD0 /* ConfirmPasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08011B90D2BA007A4DD0 /* ConfirmPasscodeState.swift */; }; + C9DC08051B90D394007A4DD0 /* ChangePasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08041B90D394007A4DD0 /* ChangePasscodeState.swift */; }; + C9DC08061B90D394007A4DD0 /* ChangePasscodeState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08041B90D394007A4DD0 /* ChangePasscodeState.swift */; }; + C9DC08081B90DAE6007A4DD0 /* EnterPasscodeStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08071B90DAE6007A4DD0 /* EnterPasscodeStateTests.swift */; }; + C9DC080A1B90DB09007A4DD0 /* FakePasscodeLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08091B90DB09007A4DD0 /* FakePasscodeLock.swift */; }; + C9DC080C1B90DC38007A4DD0 /* SetPasscodeStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC080B1B90DC38007A4DD0 /* SetPasscodeStateTests.swift */; }; + C9DC080E1B90DC8F007A4DD0 /* ConfirmPasscodeStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC080D1B90DC8F007A4DD0 /* ConfirmPasscodeStateTests.swift */; }; + C9DC08101B90DD91007A4DD0 /* ChangePasscodeStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC080F1B90DD91007A4DD0 /* ChangePasscodeStateTests.swift */; }; + C9DC08121B90DE1B007A4DD0 /* PasscodeSignPlaceholderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08111B90DE1B007A4DD0 /* PasscodeSignPlaceholderView.swift */; }; + C9DC08141B90DE50007A4DD0 /* PasscodeSignButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08131B90DE50007A4DD0 /* PasscodeSignButton.swift */; }; + C9DC08161B90DF4E007A4DD0 /* PasscodeLockViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC08151B90DF4E007A4DD0 /* PasscodeLockViewController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -104,6 +104,9 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 412C87FF1E253A1B00693041 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = fa.lproj/Main.strings; sourceTree = ""; }; + 412C88001E253A1B00693041 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = fa.lproj/LaunchScreen.strings; sourceTree = ""; }; + 412C88071E253A1C00693041 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = fa.lproj/PasscodeLock.strings; sourceTree = ""; }; C99EAF3F1B90B05700D61E1B /* PasscodeLock.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PasscodeLock.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C99EAF421B90B05700D61E1B /* PasscodeLock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PasscodeLock.h; sourceTree = ""; }; C99EAF441B90B05700D61E1B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -451,9 +454,11 @@ TargetAttributes = { C99EAF3E1B90B05700D61E1B = { CreatedOnToolsVersion = 7.0; + LastSwiftMigration = 0800; }; C99EAF481B90B05700D61E1B = { CreatedOnToolsVersion = 7.0; + LastSwiftMigration = 0800; }; C9D3DF0F1B91AD11008561EB = { CreatedOnToolsVersion = 7.0; @@ -475,6 +480,7 @@ knownRegions = ( en, Base, + fa, ); mainGroup = C99EAF351B90B05700D61E1B; productRefGroup = C99EAF401B90B05700D61E1B /* Products */; @@ -638,6 +644,7 @@ isa = PBXVariantGroup; children = ( C9D3DF171B91AD11008561EB /* Base */, + 412C87FF1E253A1B00693041 /* fa */, ); name = Main.storyboard; sourceTree = ""; @@ -646,6 +653,7 @@ isa = PBXVariantGroup; children = ( C9D3DF1C1B91AD11008561EB /* Base */, + 412C88001E253A1B00693041 /* fa */, ); name = LaunchScreen.storyboard; sourceTree = ""; @@ -654,6 +662,7 @@ isa = PBXVariantGroup; children = ( C9DC07FB1B90D0A3007A4DD0 /* en */, + 412C88071E253A1C00693041 /* fa */, ); name = PasscodeLock.strings; sourceTree = ""; @@ -765,6 +774,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -782,6 +792,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.yankodimitrov.PasscodeLock; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; }; name = Release; }; @@ -795,6 +806,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "PasscodeLockTests/PasscodeLockTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -807,6 +819,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.yankodimitrov.PasscodeLockTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "PasscodeLockTests/PasscodeLockTests-Bridging-Header.h"; + SWIFT_VERSION = 3.0; }; name = Release; }; diff --git a/PasscodeLock/Functions.swift b/PasscodeLock/Functions.swift index adb03903..173caf16 100644 --- a/PasscodeLock/Functions.swift +++ b/PasscodeLock/Functions.swift @@ -8,7 +8,7 @@ import Foundation -func localizedStringFor(key: String, comment: String) -> String { +func localizedStringFor(_ key: String, comment: String) -> String { let name = "PasscodeLock" let bundle = bundleForResource(name, ofType: "strings") @@ -16,11 +16,11 @@ func localizedStringFor(key: String, comment: String) -> String { return NSLocalizedString(key, tableName: name, bundle: bundle, comment: comment) } -func bundleForResource(name: String, ofType type: String) -> NSBundle { +func bundleForResource(_ name: String, ofType type: String) -> Bundle { - if(NSBundle.mainBundle().pathForResource(name, ofType: type) != nil) { - return NSBundle.mainBundle() + if(Bundle.main.path(forResource: name, ofType: type) != nil) { + return Bundle.main } - return NSBundle(forClass: PasscodeLock.self) + return Bundle(for: PasscodeLock.self) } diff --git a/PasscodeLock/PasscodeLock/ChangePasscodeState.swift b/PasscodeLock/PasscodeLock/ChangePasscodeState.swift index 1106f145..aefaacae 100644 --- a/PasscodeLock/PasscodeLock/ChangePasscodeState.swift +++ b/PasscodeLock/PasscodeLock/ChangePasscodeState.swift @@ -21,7 +21,7 @@ struct ChangePasscodeState: PasscodeLockStateType { description = localizedStringFor("PasscodeLockChangeDescription", comment: "Change passcode description") } - func acceptPasscode(passcode: [String], fromLock lock: PasscodeLockType) { + func acceptPasscode(_ passcode: [String], fromLock lock: PasscodeLockType) { guard let currentPasscode = lock.repository.passcode else { return diff --git a/PasscodeLock/PasscodeLock/ConfirmPasscodeState.swift b/PasscodeLock/PasscodeLock/ConfirmPasscodeState.swift index c6683cea..371562b5 100644 --- a/PasscodeLock/PasscodeLock/ConfirmPasscodeState.swift +++ b/PasscodeLock/PasscodeLock/ConfirmPasscodeState.swift @@ -15,7 +15,7 @@ struct ConfirmPasscodeState: PasscodeLockStateType { let isCancellableAction = true var isTouchIDAllowed = false - private var passcodeToConfirm: [String] + fileprivate var passcodeToConfirm: [String] init(passcode: [String]) { @@ -24,7 +24,7 @@ struct ConfirmPasscodeState: PasscodeLockStateType { description = localizedStringFor("PasscodeLockConfirmDescription", comment: "Confirm passcode description") } - func acceptPasscode(passcode: [String], fromLock lock: PasscodeLockType) { + func acceptPasscode(_ passcode: [String], fromLock lock: PasscodeLockType) { if passcode == passcodeToConfirm { diff --git a/PasscodeLock/PasscodeLock/EnterPasscodeState.swift b/PasscodeLock/PasscodeLock/EnterPasscodeState.swift index 60f58bc8..6716e0cd 100644 --- a/PasscodeLock/PasscodeLock/EnterPasscodeState.swift +++ b/PasscodeLock/PasscodeLock/EnterPasscodeState.swift @@ -17,8 +17,8 @@ struct EnterPasscodeState: PasscodeLockStateType { let isCancellableAction: Bool var isTouchIDAllowed = true - private var inccorectPasscodeAttempts = 0 - private var isNotificationSent = false + fileprivate var inccorectPasscodeAttempts = 0 + fileprivate var isNotificationSent = false init(allowCancellation: Bool = false) { @@ -27,7 +27,7 @@ struct EnterPasscodeState: PasscodeLockStateType { description = localizedStringFor("PasscodeLockEnterDescription", comment: "Enter passcode description") } - mutating func acceptPasscode(passcode: [String], fromLock lock: PasscodeLockType) { + mutating func acceptPasscode(_ passcode: [String], fromLock lock: PasscodeLockType) { guard let currentPasscode = lock.repository.passcode else { return @@ -50,13 +50,13 @@ struct EnterPasscodeState: PasscodeLockStateType { } } - private mutating func postNotification() { + fileprivate mutating func postNotification() { guard !isNotificationSent else { return } - let center = NSNotificationCenter.defaultCenter() + let center = NotificationCenter.default - center.postNotificationName(PasscodeLockIncorrectPasscodeNotification, object: nil) + center.post(name: Notification.Name(rawValue: PasscodeLockIncorrectPasscodeNotification), object: nil) isNotificationSent = true } diff --git a/PasscodeLock/PasscodeLock/PasscodeLock.swift b/PasscodeLock/PasscodeLock/PasscodeLock.swift index a6ca8372..dc5698f5 100644 --- a/PasscodeLock/PasscodeLock/PasscodeLock.swift +++ b/PasscodeLock/PasscodeLock/PasscodeLock.swift @@ -9,25 +9,25 @@ import Foundation import LocalAuthentication -public class PasscodeLock: PasscodeLockType { +open class PasscodeLock: PasscodeLockType { - public weak var delegate: PasscodeLockTypeDelegate? - public let configuration: PasscodeLockConfigurationType + open weak var delegate: PasscodeLockTypeDelegate? + open let configuration: PasscodeLockConfigurationType - public var repository: PasscodeRepositoryType { + open var repository: PasscodeRepositoryType { return configuration.repository } - public var state: PasscodeLockStateType { + open var state: PasscodeLockStateType { return lockState } - public var isTouchIDAllowed: Bool { + open var isTouchIDAllowed: Bool { return isTouchIDEnabled() && configuration.isTouchIDAllowed && lockState.isTouchIDAllowed } - private var lockState: PasscodeLockStateType - private lazy var passcode = [String]() + fileprivate var lockState: PasscodeLockStateType + fileprivate lazy var passcode = [String]() public init(state: PasscodeLockStateType, configuration: PasscodeLockConfigurationType) { @@ -37,7 +37,7 @@ public class PasscodeLock: PasscodeLockType { self.configuration = configuration } - public func addSign(sign: String) { + open func addSign(_ sign: String) { passcode.append(sign) delegate?.passcodeLock(self, addedSignAtIndex: passcode.count - 1) @@ -45,11 +45,11 @@ public class PasscodeLock: PasscodeLockType { if passcode.count >= configuration.passcodeLength { lockState.acceptPasscode(passcode, fromLock: self) - passcode.removeAll(keepCapacity: true) + passcode.removeAll(keepingCapacity: true) } } - public func removeSign() { + open func removeSign() { guard passcode.count > 0 else { return } @@ -57,13 +57,13 @@ public class PasscodeLock: PasscodeLockType { delegate?.passcodeLock(self, removedSignAtIndex: passcode.count) } - public func changeStateTo(state: PasscodeLockStateType) { + open func changeStateTo(_ state: PasscodeLockStateType) { lockState = state delegate?.passcodeLockDidChangeState(self) } - public func authenticateWithBiometrics() { + open func authenticateWithBiometrics() { guard isTouchIDAllowed else { return } @@ -72,16 +72,16 @@ public class PasscodeLock: PasscodeLockType { context.localizedFallbackTitle = localizedStringFor("PasscodeLockTouchIDButton", comment: "TouchID authentication fallback button") - context.evaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics, localizedReason: reason) { + context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason) { success, error in self.handleTouchIDResult(success) } } - private func handleTouchIDResult(success: Bool) { + fileprivate func handleTouchIDResult(_ success: Bool) { - dispatch_async(dispatch_get_main_queue()) { + DispatchQueue.main.async { if success { @@ -90,10 +90,10 @@ public class PasscodeLock: PasscodeLockType { } } - private func isTouchIDEnabled() -> Bool { + fileprivate func isTouchIDEnabled() -> Bool { let context = LAContext() - return context.canEvaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics, error: nil) + return context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil) } } diff --git a/PasscodeLock/PasscodeLock/SetPasscodeState.swift b/PasscodeLock/PasscodeLock/SetPasscodeState.swift index f4a96be9..b43e4bbb 100644 --- a/PasscodeLock/PasscodeLock/SetPasscodeState.swift +++ b/PasscodeLock/PasscodeLock/SetPasscodeState.swift @@ -27,7 +27,7 @@ struct SetPasscodeState: PasscodeLockStateType { description = localizedStringFor("PasscodeLockSetDescription", comment: "Set passcode description") } - func acceptPasscode(passcode: [String], fromLock lock: PasscodeLockType) { + func acceptPasscode(_ passcode: [String], fromLock lock: PasscodeLockType) { let nextState = ConfirmPasscodeState(passcode: passcode) diff --git a/PasscodeLock/PasscodeLockPresenter.swift b/PasscodeLock/PasscodeLockPresenter.swift index c2ac3d6d..611cc4a2 100644 --- a/PasscodeLock/PasscodeLockPresenter.swift +++ b/PasscodeLock/PasscodeLockPresenter.swift @@ -8,13 +8,13 @@ import UIKit -public class PasscodeLockPresenter { +open class PasscodeLockPresenter { - private var mainWindow: UIWindow? + fileprivate var mainWindow: UIWindow? - private lazy var passcodeLockWindow: UIWindow = { + fileprivate lazy var passcodeLockWindow: UIWindow = { - let window = UIWindow(frame: UIScreen.mainScreen().bounds) + let window = UIWindow(frame: UIScreen.main.bounds) window.windowLevel = 0 window.makeKeyAndVisible() @@ -22,9 +22,9 @@ public class PasscodeLockPresenter { return window }() - private let passcodeConfiguration: PasscodeLockConfigurationType - public var isPasscodePresented = false - public let passcodeLockVC: PasscodeLockViewController + fileprivate let passcodeConfiguration: PasscodeLockConfigurationType + open var isPasscodePresented = false + open let passcodeLockVC: PasscodeLockViewController public init(mainWindow window: UIWindow?, configuration: PasscodeLockConfigurationType, viewController: PasscodeLockViewController) { @@ -37,12 +37,12 @@ public class PasscodeLockPresenter { public convenience init(mainWindow window: UIWindow?, configuration: PasscodeLockConfigurationType) { - let passcodeLockVC = PasscodeLockViewController(state: .EnterPasscode, configuration: configuration) + let passcodeLockVC = PasscodeLockViewController(state: .enterPasscode, configuration: configuration) self.init(mainWindow: window, configuration: configuration, viewController: passcodeLockVC) } - public func presentPasscodeLock() { + open func presentPasscodeLock() { guard passcodeConfiguration.repository.hasPasscode else { return } guard !isPasscodePresented else { return } @@ -50,12 +50,12 @@ public class PasscodeLockPresenter { isPasscodePresented = true passcodeLockWindow.windowLevel = 2 - passcodeLockWindow.hidden = false + passcodeLockWindow.isHidden = false mainWindow?.windowLevel = 1 mainWindow?.endEditing(true) - let passcodeLockVC = PasscodeLockViewController(state: .EnterPasscode, configuration: passcodeConfiguration) + let passcodeLockVC = PasscodeLockViewController(state: .enterPasscode, configuration: passcodeConfiguration) let userDismissCompletionCallback = passcodeLockVC.dismissCompletionCallback passcodeLockVC.dismissCompletionCallback = { [weak self] in @@ -68,7 +68,7 @@ public class PasscodeLockPresenter { passcodeLockWindow.rootViewController = passcodeLockVC } - public func dismissPasscodeLock(animated animated: Bool = true) { + open func dismissPasscodeLock(animated: Bool = true) { isPasscodePresented = false mainWindow?.windowLevel = 1 @@ -87,12 +87,12 @@ public class PasscodeLockPresenter { internal func animatePasscodeLockDismissal() { - UIView.animateWithDuration( - 0.5, + UIView.animate( + withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0, - options: [.CurveEaseInOut], + options: UIViewAnimationOptions(), animations: { [weak self] in self?.passcodeLockWindow.alpha = 0 diff --git a/PasscodeLock/PasscodeLockViewController.swift b/PasscodeLock/PasscodeLockViewController.swift index 095f10f2..622f488a 100644 --- a/PasscodeLock/PasscodeLockViewController.swift +++ b/PasscodeLock/PasscodeLockViewController.swift @@ -8,43 +8,43 @@ import UIKit -public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDelegate { +open class PasscodeLockViewController: UIViewController, PasscodeLockTypeDelegate { public enum LockState { - case EnterPasscode - case SetPasscode - case ChangePasscode - case RemovePasscode + case enterPasscode + case setPasscode + case changePasscode + case removePasscode func getState() -> PasscodeLockStateType { switch self { - case .EnterPasscode: return EnterPasscodeState() - case .SetPasscode: return SetPasscodeState() - case .ChangePasscode: return ChangePasscodeState() - case .RemovePasscode: return EnterPasscodeState(allowCancellation: true) + case .enterPasscode: return EnterPasscodeState() + case .setPasscode: return SetPasscodeState() + case .changePasscode: return ChangePasscodeState() + case .removePasscode: return EnterPasscodeState(allowCancellation: true) } } } - @IBOutlet public weak var titleLabel: UILabel? - @IBOutlet public weak var descriptionLabel: UILabel? - @IBOutlet public var placeholders: [PasscodeSignPlaceholderView] = [PasscodeSignPlaceholderView]() - @IBOutlet public weak var cancelButton: UIButton? - @IBOutlet public weak var deleteSignButton: UIButton? - @IBOutlet public weak var touchIDButton: UIButton? - @IBOutlet public weak var placeholdersX: NSLayoutConstraint? + @IBOutlet open weak var titleLabel: UILabel? + @IBOutlet open weak var descriptionLabel: UILabel? + @IBOutlet open var placeholders: [PasscodeSignPlaceholderView] = [PasscodeSignPlaceholderView]() + @IBOutlet open weak var cancelButton: UIButton? + @IBOutlet open weak var deleteSignButton: UIButton? + @IBOutlet open weak var touchIDButton: UIButton? + @IBOutlet open weak var placeholdersX: NSLayoutConstraint? - public var successCallback: ((lock: PasscodeLockType) -> Void)? - public var dismissCompletionCallback: (()->Void)? - public var animateOnDismiss: Bool - public var notificationCenter: NSNotificationCenter? + open var successCallback: ((_ lock: PasscodeLockType) -> Void)? + open var dismissCompletionCallback: (()->Void)? + open var animateOnDismiss: Bool + open var notificationCenter: NotificationCenter? internal let passcodeConfiguration: PasscodeLockConfigurationType internal let passcodeLock: PasscodeLockType internal var isPlaceholdersAnimationCompleted = true - private var shouldTryToAuthenticateWithBiometrics = true + fileprivate var shouldTryToAuthenticateWithBiometrics = true // MARK: - Initializers @@ -56,12 +56,12 @@ public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDeleg passcodeLock = PasscodeLock(state: state, configuration: configuration) let nibName = "PasscodeLockView" - let bundle: NSBundle = bundleForResource(nibName, ofType: "nib") + let bundle: Bundle = bundleForResource(nibName, ofType: "nib") super.init(nibName: nibName, bundle: bundle) passcodeLock.delegate = self - notificationCenter = NSNotificationCenter.defaultCenter() + notificationCenter = NotificationCenter.default } public convenience init(state: LockState, configuration: PasscodeLockConfigurationType, animateOnDismiss: Bool = true) { @@ -80,16 +80,16 @@ public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDeleg // MARK: - View - public override func viewDidLoad() { + open override func viewDidLoad() { super.viewDidLoad() updatePasscodeView() - deleteSignButton?.enabled = false + deleteSignButton?.isEnabled = false setupEvents() } - public override func viewDidAppear(animated: Bool) { + open override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) if shouldTryToAuthenticateWithBiometrics { @@ -102,59 +102,59 @@ public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDeleg titleLabel?.text = passcodeLock.state.title descriptionLabel?.text = passcodeLock.state.description - cancelButton?.hidden = !passcodeLock.state.isCancellableAction - touchIDButton?.hidden = !passcodeLock.isTouchIDAllowed + cancelButton?.isHidden = !passcodeLock.state.isCancellableAction + touchIDButton?.isHidden = !passcodeLock.isTouchIDAllowed } // MARK: - Events - private func setupEvents() { + fileprivate func setupEvents() { - notificationCenter?.addObserver(self, selector: "appWillEnterForegroundHandler:", name: UIApplicationWillEnterForegroundNotification, object: nil) - notificationCenter?.addObserver(self, selector: "appDidEnterBackgroundHandler:", name: UIApplicationDidEnterBackgroundNotification, object: nil) + notificationCenter?.addObserver(self, selector: #selector(PasscodeLockViewController.appWillEnterForegroundHandler(_:)), name: NSNotification.Name.UIApplicationWillEnterForeground, object: nil) + notificationCenter?.addObserver(self, selector: #selector(PasscodeLockViewController.appDidEnterBackgroundHandler(_:)), name: NSNotification.Name.UIApplicationDidEnterBackground, object: nil) } - private func clearEvents() { + fileprivate func clearEvents() { - notificationCenter?.removeObserver(self, name: UIApplicationWillEnterForegroundNotification, object: nil) - notificationCenter?.removeObserver(self, name: UIApplicationDidEnterBackgroundNotification, object: nil) + notificationCenter?.removeObserver(self, name: NSNotification.Name.UIApplicationWillEnterForeground, object: nil) + notificationCenter?.removeObserver(self, name: NSNotification.Name.UIApplicationDidEnterBackground, object: nil) } - public func appWillEnterForegroundHandler(notification: NSNotification) { + open func appWillEnterForegroundHandler(_ notification: Notification) { authenticateWithBiometrics() } - public func appDidEnterBackgroundHandler(notification: NSNotification) { + open func appDidEnterBackgroundHandler(_ notification: Notification) { shouldTryToAuthenticateWithBiometrics = false } // MARK: - Actions - @IBAction func passcodeSignButtonTap(sender: PasscodeSignButton) { + @IBAction func passcodeSignButtonTap(_ sender: PasscodeSignButton) { guard isPlaceholdersAnimationCompleted else { return } passcodeLock.addSign(sender.passcodeSign) } - @IBAction func cancelButtonTap(sender: UIButton) { + @IBAction func cancelButtonTap(_ sender: UIButton) { dismissPasscodeLock(passcodeLock) } - @IBAction func deleteSignButtonTap(sender: UIButton) { + @IBAction func deleteSignButtonTap(_ sender: UIButton) { passcodeLock.removeSign() } - @IBAction func touchIDButtonTap(sender: UIButton) { + @IBAction func touchIDButtonTap(_ sender: UIButton) { passcodeLock.authenticateWithBiometrics() } - private func authenticateWithBiometrics() { + fileprivate func authenticateWithBiometrics() { if passcodeConfiguration.shouldRequestTouchIDImmediately && passcodeLock.isTouchIDAllowed { @@ -162,12 +162,12 @@ public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDeleg } } - internal func dismissPasscodeLock(lock: PasscodeLockType, completionHandler: (() -> Void)? = nil) { + internal func dismissPasscodeLock(_ lock: PasscodeLockType, completionHandler: (() -> Void)? = nil) { // if presented as modal if presentingViewController?.presentedViewController == self { - dismissViewControllerAnimated(animateOnDismiss, completion: { [weak self] _ in + dismiss(animated: animateOnDismiss, completion: { [weak self] _ in self?.dismissCompletionCallback?() @@ -179,7 +179,7 @@ public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDeleg // if pushed in a navigation controller } else if navigationController != nil { - navigationController?.popViewControllerAnimated(animateOnDismiss) + _ = navigationController?.popViewController(animated: animateOnDismiss) } dismissCompletionCallback?() @@ -191,16 +191,16 @@ public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDeleg internal func animateWrongPassword() { - deleteSignButton?.enabled = false + deleteSignButton?.isEnabled = false isPlaceholdersAnimationCompleted = false - animatePlaceholders(placeholders, toState: .Error) + animatePlaceholders(placeholders, toState: .error) placeholdersX?.constant = -40 view.layoutIfNeeded() - UIView.animateWithDuration( - 0.5, + UIView.animate( + withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.2, initialSpringVelocity: 0, @@ -213,11 +213,11 @@ public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDeleg completion: { completed in self.isPlaceholdersAnimationCompleted = true - self.animatePlaceholders(self.placeholders, toState: .Inactive) + self.animatePlaceholders(self.placeholders, toState: .inactive) }) } - internal func animatePlaceholders(placeholders: [PasscodeSignPlaceholderView], toState state: PasscodeSignPlaceholderView.State) { + internal func animatePlaceholders(_ placeholders: [PasscodeSignPlaceholderView], toState state: PasscodeSignPlaceholderView.State) { for placeholder in placeholders { @@ -225,7 +225,7 @@ public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDeleg } } - private func animatePlacehodlerAtIndex(index: Int, toState state: PasscodeSignPlaceholderView.State) { + fileprivate func animatePlacehodlerAtIndex(_ index: Int, toState state: PasscodeSignPlaceholderView.State) { guard index < placeholders.count && index >= 0 else { return } @@ -234,40 +234,40 @@ public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDeleg // MARK: - PasscodeLockDelegate - public func passcodeLockDidSucceed(lock: PasscodeLockType) { + open func passcodeLockDidSucceed(_ lock: PasscodeLockType) { - deleteSignButton?.enabled = true - animatePlaceholders(placeholders, toState: .Inactive) + deleteSignButton?.isEnabled = true + animatePlaceholders(placeholders, toState: .inactive) dismissPasscodeLock(lock, completionHandler: { [weak self] _ in - self?.successCallback?(lock: lock) + self?.successCallback?(lock) }) } - public func passcodeLockDidFail(lock: PasscodeLockType) { + open func passcodeLockDidFail(_ lock: PasscodeLockType) { animateWrongPassword() } - public func passcodeLockDidChangeState(lock: PasscodeLockType) { + open func passcodeLockDidChangeState(_ lock: PasscodeLockType) { updatePasscodeView() - animatePlaceholders(placeholders, toState: .Inactive) - deleteSignButton?.enabled = false + animatePlaceholders(placeholders, toState: .inactive) + deleteSignButton?.isEnabled = false } - public func passcodeLock(lock: PasscodeLockType, addedSignAtIndex index: Int) { + open func passcodeLock(_ lock: PasscodeLockType, addedSignAtIndex index: Int) { - animatePlacehodlerAtIndex(index, toState: .Active) - deleteSignButton?.enabled = true + animatePlacehodlerAtIndex(index, toState: .active) + deleteSignButton?.isEnabled = true } - public func passcodeLock(lock: PasscodeLockType, removedSignAtIndex index: Int) { + open func passcodeLock(_ lock: PasscodeLockType, removedSignAtIndex index: Int) { - animatePlacehodlerAtIndex(index, toState: .Inactive) + animatePlacehodlerAtIndex(index, toState: .inactive) if index == 0 { - deleteSignButton?.enabled = false + deleteSignButton?.isEnabled = false } } } diff --git a/PasscodeLock/Protocols/PasscodeLockStateType.swift b/PasscodeLock/Protocols/PasscodeLockStateType.swift index d9725f15..f246e2d9 100644 --- a/PasscodeLock/Protocols/PasscodeLockStateType.swift +++ b/PasscodeLock/Protocols/PasscodeLockStateType.swift @@ -15,5 +15,5 @@ public protocol PasscodeLockStateType { var isCancellableAction: Bool {get} var isTouchIDAllowed: Bool {get} - mutating func acceptPasscode(passcode: [String], fromLock lock: PasscodeLockType) + mutating func acceptPasscode(_ passcode: [String], fromLock lock: PasscodeLockType) } diff --git a/PasscodeLock/Protocols/PasscodeLockType.swift b/PasscodeLock/Protocols/PasscodeLockType.swift index e236b05c..434c87d6 100644 --- a/PasscodeLock/Protocols/PasscodeLockType.swift +++ b/PasscodeLock/Protocols/PasscodeLockType.swift @@ -16,17 +16,17 @@ public protocol PasscodeLockType { var state: PasscodeLockStateType {get} var isTouchIDAllowed: Bool {get} - func addSign(sign: String) + func addSign(_ sign: String) func removeSign() - func changeStateTo(state: PasscodeLockStateType) + func changeStateTo(_ state: PasscodeLockStateType) func authenticateWithBiometrics() } public protocol PasscodeLockTypeDelegate: class { - func passcodeLockDidSucceed(lock: PasscodeLockType) - func passcodeLockDidFail(lock: PasscodeLockType) - func passcodeLockDidChangeState(lock: PasscodeLockType) - func passcodeLock(lock: PasscodeLockType, addedSignAtIndex index: Int) - func passcodeLock(lock: PasscodeLockType, removedSignAtIndex index: Int) + func passcodeLockDidSucceed(_ lock: PasscodeLockType) + func passcodeLockDidFail(_ lock: PasscodeLockType) + func passcodeLockDidChangeState(_ lock: PasscodeLockType) + func passcodeLock(_ lock: PasscodeLockType, addedSignAtIndex index: Int) + func passcodeLock(_ lock: PasscodeLockType, removedSignAtIndex index: Int) } diff --git a/PasscodeLock/Protocols/PasscodeRepositoryType.swift b/PasscodeLock/Protocols/PasscodeRepositoryType.swift index 19272379..79475434 100644 --- a/PasscodeLock/Protocols/PasscodeRepositoryType.swift +++ b/PasscodeLock/Protocols/PasscodeRepositoryType.swift @@ -13,6 +13,6 @@ public protocol PasscodeRepositoryType { var hasPasscode: Bool {get} var passcode: [String]? {get} - func savePasscode(passcode: [String]) + func savePasscode(_ passcode: [String]) func deletePasscode() } diff --git a/PasscodeLock/Views/PasscodeSignButton.swift b/PasscodeLock/Views/PasscodeSignButton.swift index 9fb3968a..01f7eff6 100644 --- a/PasscodeLock/Views/PasscodeSignButton.swift +++ b/PasscodeLock/Views/PasscodeSignButton.swift @@ -9,27 +9,27 @@ import UIKit @IBDesignable -public class PasscodeSignButton: UIButton { +open class PasscodeSignButton: UIButton { @IBInspectable - public var passcodeSign: String = "1" + open var passcodeSign: String = "1" @IBInspectable - public var borderColor: UIColor = UIColor.whiteColor() { + open var borderColor: UIColor = UIColor.white { didSet { setupView() } } @IBInspectable - public var borderRadius: CGFloat = 30 { + open var borderRadius: CGFloat = 30 { didSet { setupView() } } @IBInspectable - public var highlightBackgroundColor: UIColor = UIColor.clearColor() { + open var highlightBackgroundColor: UIColor = UIColor.clear { didSet { setupView() } @@ -50,18 +50,18 @@ public class PasscodeSignButton: UIButton { setupActions() } - public override func intrinsicContentSize() -> CGSize { + open override var intrinsicContentSize : CGSize { - return CGSizeMake(60, 60) + return CGSize(width: 60, height: 60) } - private var defaultBackgroundColor = UIColor.clearColor() + fileprivate var defaultBackgroundColor = UIColor.clear - private func setupView() { + fileprivate func setupView() { layer.borderWidth = 1 layer.cornerRadius = borderRadius - layer.borderColor = borderColor.CGColor + layer.borderColor = borderColor.cgColor if let backgroundColor = backgroundColor { @@ -69,10 +69,10 @@ public class PasscodeSignButton: UIButton { } } - private func setupActions() { + fileprivate func setupActions() { - addTarget(self, action: Selector("handleTouchDown"), forControlEvents: .TouchDown) - addTarget(self, action: Selector("handleTouchUp"), forControlEvents: [.TouchUpInside, .TouchDragOutside, .TouchCancel]) + addTarget(self, action: #selector(PasscodeSignButton.handleTouchDown), for: .touchDown) + addTarget(self, action: #selector(PasscodeSignButton.handleTouchUp), for: [.touchUpInside, .touchDragOutside, .touchCancel]) } func handleTouchDown() { @@ -85,14 +85,14 @@ public class PasscodeSignButton: UIButton { animateBackgroundColor(defaultBackgroundColor) } - private func animateBackgroundColor(color: UIColor) { + fileprivate func animateBackgroundColor(_ color: UIColor) { - UIView.animateWithDuration( - 0.3, + UIView.animate( + withDuration: 0.3, delay: 0.0, usingSpringWithDamping: 1, initialSpringVelocity: 0.0, - options: [.AllowUserInteraction, .BeginFromCurrentState], + options: [.allowUserInteraction, .beginFromCurrentState], animations: { self.backgroundColor = color diff --git a/PasscodeLock/Views/PasscodeSignPlaceholderView.swift b/PasscodeLock/Views/PasscodeSignPlaceholderView.swift index 953c9ef4..2191a302 100644 --- a/PasscodeLock/Views/PasscodeSignPlaceholderView.swift +++ b/PasscodeLock/Views/PasscodeSignPlaceholderView.swift @@ -9,30 +9,30 @@ import UIKit @IBDesignable -public class PasscodeSignPlaceholderView: UIView { +open class PasscodeSignPlaceholderView: UIView { public enum State { - case Inactive - case Active - case Error + case inactive + case active + case error } @IBInspectable - public var inactiveColor: UIColor = UIColor.whiteColor() { + open var inactiveColor: UIColor = UIColor.white { didSet { setupView() } } @IBInspectable - public var activeColor: UIColor = UIColor.grayColor() { + open var activeColor: UIColor = UIColor.gray { didSet { setupView() } } @IBInspectable - public var errorColor: UIColor = UIColor.redColor() { + open var errorColor: UIColor = UIColor.red { didSet { setupView() } @@ -50,34 +50,34 @@ public class PasscodeSignPlaceholderView: UIView { super.init(coder: aDecoder) } - public override func intrinsicContentSize() -> CGSize { + open override var intrinsicContentSize : CGSize { - return CGSizeMake(16, 16) + return CGSize(width: 16, height: 16) } - private func setupView() { + fileprivate func setupView() { layer.cornerRadius = 8 layer.borderWidth = 1 - layer.borderColor = activeColor.CGColor + layer.borderColor = activeColor.cgColor backgroundColor = inactiveColor } - private func colorsForState(state: State) -> (backgroundColor: UIColor, borderColor: UIColor) { + fileprivate func colorsForState(_ state: State) -> (backgroundColor: UIColor, borderColor: UIColor) { switch state { - case .Inactive: return (inactiveColor, activeColor) - case .Active: return (activeColor, activeColor) - case .Error: return (errorColor, errorColor) + case .inactive: return (inactiveColor, activeColor) + case .active: return (activeColor, activeColor) + case .error: return (errorColor, errorColor) } } - public func animateState(state: State) { + open func animateState(_ state: State) { let colors = colorsForState(state) - UIView.animateWithDuration( - 0.5, + UIView.animate( + withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0, @@ -85,7 +85,7 @@ public class PasscodeSignPlaceholderView: UIView { animations: { self.backgroundColor = colors.backgroundColor - self.layer.borderColor = colors.borderColor.CGColor + self.layer.borderColor = colors.borderColor.cgColor }, completion: nil diff --git a/PasscodeLockDemo/Base.lproj/Main.storyboard b/PasscodeLockDemo/Base.lproj/Main.storyboard index bea52e36..76d5c03e 100644 --- a/PasscodeLockDemo/Base.lproj/Main.storyboard +++ b/PasscodeLockDemo/Base.lproj/Main.storyboard @@ -1,8 +1,9 @@ - - + + - + + @@ -14,44 +15,44 @@ - + - - + diff --git a/PasscodeLockTests/Fakes/FakePasscodeLock.swift b/PasscodeLockTests/Fakes/FakePasscodeLock.swift index 518710e3..8975eaa9 100644 --- a/PasscodeLockTests/Fakes/FakePasscodeLock.swift +++ b/PasscodeLockTests/Fakes/FakePasscodeLock.swift @@ -25,7 +25,7 @@ class FakePasscodeLock: PasscodeLockType { self.configuration = configuration } - func addSign(sign: String) { + func addSign(_ sign: String) { } @@ -33,7 +33,7 @@ class FakePasscodeLock: PasscodeLockType { } - func changeStateTo(state: PasscodeLockStateType) { + func changeStateTo(_ state: PasscodeLockStateType) { lockState = state changeStateCalled = true diff --git a/PasscodeLockTests/Fakes/FakePasscodeLockDelegate.swift b/PasscodeLockTests/Fakes/FakePasscodeLockDelegate.swift index 3d82b9bf..72d4b85a 100644 --- a/PasscodeLockTests/Fakes/FakePasscodeLockDelegate.swift +++ b/PasscodeLockTests/Fakes/FakePasscodeLockDelegate.swift @@ -10,9 +10,9 @@ import Foundation class FakePasscodeLockDelegate: PasscodeLockTypeDelegate { - func passcodeLockDidSucceed(lock: PasscodeLockType) {} - func passcodeLockDidFail(lock: PasscodeLockType) {} - func passcodeLockDidChangeState(lock: PasscodeLockType) {} - func passcodeLock(lock: PasscodeLockType, addedSignAtIndex index: Int) {} - func passcodeLock(lock: PasscodeLockType, removedSignAtIndex index: Int) {} + func passcodeLockDidSucceed(_ lock: PasscodeLockType) {} + func passcodeLockDidFail(_ lock: PasscodeLockType) {} + func passcodeLockDidChangeState(_ lock: PasscodeLockType) {} + func passcodeLock(_ lock: PasscodeLockType, addedSignAtIndex index: Int) {} + func passcodeLock(_ lock: PasscodeLockType, removedSignAtIndex index: Int) {} } diff --git a/PasscodeLockTests/Fakes/FakePasscodeRepository.swift b/PasscodeLockTests/Fakes/FakePasscodeRepository.swift index 657b67fc..9c210521 100644 --- a/PasscodeLockTests/Fakes/FakePasscodeRepository.swift +++ b/PasscodeLockTests/Fakes/FakePasscodeRepository.swift @@ -18,7 +18,7 @@ class FakePasscodeRepository: PasscodeRepositoryType { var savePasscodeCalled = false var savedPasscode = [String]() - func savePasscode(passcode: [String]) { + func savePasscode(_ passcode: [String]) { savePasscodeCalled = true savedPasscode = passcode diff --git a/PasscodeLockTests/Fakes/FakePasscodeState.swift b/PasscodeLockTests/Fakes/FakePasscodeState.swift index 61bc3e3c..e2b345a4 100644 --- a/PasscodeLockTests/Fakes/FakePasscodeState.swift +++ b/PasscodeLockTests/Fakes/FakePasscodeState.swift @@ -21,7 +21,7 @@ class FakePasscodeState: PasscodeLockStateType { init() {} - func acceptPasscode(passcode: [String], fromLock lock: PasscodeLockType) { + func acceptPasscode(_ passcode: [String], fromLock lock: PasscodeLockType) { acceptedPasscode = passcode acceptPaccodeCalled = true diff --git a/PasscodeLockTests/PasscodeLock/ChangePasscodeStateTests.swift b/PasscodeLockTests/PasscodeLock/ChangePasscodeStateTests.swift index eade20ca..721b5ce5 100644 --- a/PasscodeLockTests/PasscodeLock/ChangePasscodeStateTests.swift +++ b/PasscodeLockTests/PasscodeLock/ChangePasscodeStateTests.swift @@ -31,7 +31,7 @@ class ChangePasscodeStateTests: XCTestCase { var didChangedState = false - override func passcodeLockDidChangeState(lock: PasscodeLockType) { + override func passcodeLockDidChangeState(_ lock: PasscodeLockType) { didChangedState = true } @@ -52,7 +52,7 @@ class ChangePasscodeStateTests: XCTestCase { var called = false - override func passcodeLockDidFail(lock: PasscodeLockType) { + override func passcodeLockDidFail(_ lock: PasscodeLockType) { called = true } diff --git a/PasscodeLockTests/PasscodeLock/ConfirmPasscodeStateTests.swift b/PasscodeLockTests/PasscodeLock/ConfirmPasscodeStateTests.swift index f122f702..47b9dfbc 100644 --- a/PasscodeLockTests/PasscodeLock/ConfirmPasscodeStateTests.swift +++ b/PasscodeLockTests/PasscodeLock/ConfirmPasscodeStateTests.swift @@ -32,7 +32,7 @@ class ConfirmPasscodeStateTests: XCTestCase { var called = false - override func passcodeLockDidSucceed(lock: PasscodeLockType) { + override func passcodeLockDidSucceed(_ lock: PasscodeLockType) { called = true } @@ -61,12 +61,12 @@ class ConfirmPasscodeStateTests: XCTestCase { var didFailed = false var didChangedState = false - override func passcodeLockDidFail(lock: PasscodeLockType) { + override func passcodeLockDidFail(_ lock: PasscodeLockType) { didFailed = true } - override func passcodeLockDidChangeState(lock: PasscodeLockType) { + override func passcodeLockDidChangeState(_ lock: PasscodeLockType) { didChangedState = true } diff --git a/PasscodeLockTests/PasscodeLock/EnterPasscodeStateTests.swift b/PasscodeLockTests/PasscodeLock/EnterPasscodeStateTests.swift index 2e4dcf94..c8fefca2 100644 --- a/PasscodeLockTests/PasscodeLock/EnterPasscodeStateTests.swift +++ b/PasscodeLockTests/PasscodeLock/EnterPasscodeStateTests.swift @@ -13,14 +13,14 @@ class NotificaionObserver: NSObject { var called = false var callCounter = 0 - func observe(notification: String) { + func observe(_ notification: String) { - let center = NSNotificationCenter.defaultCenter() + let center = NotificationCenter.default - center.addObserver(self, selector: "handle:", name: notification, object: nil) + center.addObserver(self, selector: #selector(NotificaionObserver.handle(_:)), name: NSNotification.Name(rawValue: notification), object: nil) } - func handle(notification: NSNotification) { + func handle(_ notification: Notification) { called = true callCounter += 1 @@ -50,7 +50,7 @@ class EnterPasscodeStateTests: XCTestCase { var called = false - override func passcodeLockDidSucceed(lock: PasscodeLockType) { + override func passcodeLockDidSucceed(_ lock: PasscodeLockType) { called = true } @@ -70,7 +70,7 @@ class EnterPasscodeStateTests: XCTestCase { var called = false - override func passcodeLockDidFail(lock: PasscodeLockType) { + override func passcodeLockDidFail(_ lock: PasscodeLockType) { called = true } diff --git a/PasscodeLockTests/PasscodeLock/PasscodeLockTests.swift b/PasscodeLockTests/PasscodeLock/PasscodeLockTests.swift index efb192a3..0ec9f6b9 100644 --- a/PasscodeLockTests/PasscodeLock/PasscodeLockTests.swift +++ b/PasscodeLockTests/PasscodeLock/PasscodeLockTests.swift @@ -29,7 +29,7 @@ class PasscodeLockTests: XCTestCase { var called = false - override func passcodeLockDidChangeState(lock: PasscodeLockType) { + override func passcodeLockDidChangeState(_ lock: PasscodeLockType) { called = true } @@ -51,7 +51,7 @@ class PasscodeLockTests: XCTestCase { var called = false var signIndex = 0 - override func passcodeLock(lock: PasscodeLockType, addedSignAtIndex index: Int) { + override func passcodeLock(_ lock: PasscodeLockType, addedSignAtIndex index: Int) { called = true signIndex = index @@ -78,7 +78,7 @@ class PasscodeLockTests: XCTestCase { var called = false var signIndex = 0 - override func passcodeLock(lock: PasscodeLockType, removedSignAtIndex index: Int) { + override func passcodeLock(_ lock: PasscodeLockType, removedSignAtIndex index: Int) { called = true signIndex = index diff --git a/PasscodeLockTests/PasscodeLock/SetPasscodeStateTests.swift b/PasscodeLockTests/PasscodeLock/SetPasscodeStateTests.swift index 20ef1214..e90429a0 100644 --- a/PasscodeLockTests/PasscodeLock/SetPasscodeStateTests.swift +++ b/PasscodeLockTests/PasscodeLock/SetPasscodeStateTests.swift @@ -31,7 +31,7 @@ class SetPasscodeStateTests: XCTestCase { var didChangedState = false - override func passcodeLockDidChangeState(lock: PasscodeLockType) { + override func passcodeLockDidChangeState(_ lock: PasscodeLockType) { didChangedState = true } From a567d0e70666ae8730dbfdf30d3eaa94a119e876 Mon Sep 17 00:00:00 2001 From: Ali Zahedi Date: Tue, 10 Jan 2017 20:07:13 +0330 Subject: [PATCH 2/5] Add Persian localization --- PasscodeLock/fa.lproj/PasscodeLock.strings | 33 +++++++++++++++++++ .../fa.lproj/LaunchScreen.strings | 1 + PasscodeLockDemo/fa.lproj/Main.strings | 15 +++++++++ 3 files changed, 49 insertions(+) create mode 100755 PasscodeLock/fa.lproj/PasscodeLock.strings create mode 100644 PasscodeLockDemo/fa.lproj/LaunchScreen.strings create mode 100644 PasscodeLockDemo/fa.lproj/Main.strings diff --git a/PasscodeLock/fa.lproj/PasscodeLock.strings b/PasscodeLock/fa.lproj/PasscodeLock.strings new file mode 100755 index 00000000..c3bab840 --- /dev/null +++ b/PasscodeLock/fa.lproj/PasscodeLock.strings @@ -0,0 +1,33 @@ +/* + PasscodeLock.strings + PasscodeLock + + Created by Yanko Dimitrov on 8/28/15. + Copyright (c) 2015 Yanko Dimitrov. All rights reserved. +*/ + +/* Enter Passcode State */ +"PasscodeLockEnterTitle" = "رمز عبور"; +"PasscodeLockEnterDescription" = "رمز عبور را وارد کنید"; + +/* Set Passcode State */ +"PasscodeLockSetTitle" = "رمز عبور"; +"PasscodeLockSetDescription" = "رمز عبور دلخواه خود را وارد کنید."; + +/* Confirm Passcode State */ +"PasscodeLockConfirmTitle" = "تایید رمز عبور"; +"PasscodeLockConfirmDescription" = "رمز عبور دلخواه خود را مجدد وارد کنید."; + +/* Change Passcode State */ +"PasscodeLockChangeTitle" = "رمز عبور قبلی"; +"PasscodeLockChangeDescription" = "رمز عبور قبلی خود را وارد کنید."; + +/* Passcode Mismatch State */ +"PasscodeLockMismatchTitle" = "دوباره تلاش کنید"; +"PasscodeLockMismatchDescription" = "رمز عبور همسان نیست"; + +/* Touch ID Reason */ +"PasscodeLockTouchIDReason" = "احراز هویت برای دسترسی به برنامه"; + +/* Touch ID Fallback Button */ +"PasscodeLockTouchIDButton" = "رمز عبور"; diff --git a/PasscodeLockDemo/fa.lproj/LaunchScreen.strings b/PasscodeLockDemo/fa.lproj/LaunchScreen.strings new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/PasscodeLockDemo/fa.lproj/LaunchScreen.strings @@ -0,0 +1 @@ + diff --git a/PasscodeLockDemo/fa.lproj/Main.strings b/PasscodeLockDemo/fa.lproj/Main.strings new file mode 100644 index 00000000..66e16259 --- /dev/null +++ b/PasscodeLockDemo/fa.lproj/Main.strings @@ -0,0 +1,15 @@ + +/* Class = "UIButton"; normalTitle = "Test with Alert VC"; ObjectID = "0sQ-Ot-x0k"; */ +"0sQ-Ot-x0k.normalTitle" = "Test with Alert VC"; + +/* Class = "UIButton"; normalTitle = "Test with Activity VC"; ObjectID = "FWy-5L-Ls0"; */ +"FWy-5L-Ls0.normalTitle" = "Test with Activity VC"; + +/* Class = "UIButton"; normalTitle = "Change Passcode"; ObjectID = "hX3-sK-N1u"; */ +"hX3-sK-N1u.normalTitle" = "Change Passcode"; + +/* Class = "UITextField"; placeholder = "Test with Keyboard"; ObjectID = "rmd-tl-sFf"; */ +"rmd-tl-sFf.placeholder" = "Test with Keyboard"; + +/* Class = "UILabel"; text = "Passcode:"; ObjectID = "xNW-hY-03M"; */ +"xNW-hY-03M.text" = "Passcode:"; From fa1753289514eff54800710bd262c3aba6c5fb03 Mon Sep 17 00:00:00 2001 From: Ali Zahedi Date: Tue, 9 May 2017 15:49:05 +0430 Subject: [PATCH 3/5] a --- PasscodeLock.xcodeproj/project.pbxproj | 6 ------ 1 file changed, 6 deletions(-) diff --git a/PasscodeLock.xcodeproj/project.pbxproj b/PasscodeLock.xcodeproj/project.pbxproj index 1be9e97d..31032da3 100644 --- a/PasscodeLock.xcodeproj/project.pbxproj +++ b/PasscodeLock.xcodeproj/project.pbxproj @@ -104,9 +104,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 412C87FF1E253A1B00693041 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = fa.lproj/Main.strings; sourceTree = ""; }; - 412C88001E253A1B00693041 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = fa.lproj/LaunchScreen.strings; sourceTree = ""; }; - 412C88071E253A1C00693041 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = fa.lproj/PasscodeLock.strings; sourceTree = ""; }; C99EAF3F1B90B05700D61E1B /* PasscodeLock.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PasscodeLock.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C99EAF421B90B05700D61E1B /* PasscodeLock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PasscodeLock.h; sourceTree = ""; }; C99EAF441B90B05700D61E1B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -644,7 +641,6 @@ isa = PBXVariantGroup; children = ( C9D3DF171B91AD11008561EB /* Base */, - 412C87FF1E253A1B00693041 /* fa */, ); name = Main.storyboard; sourceTree = ""; @@ -653,7 +649,6 @@ isa = PBXVariantGroup; children = ( C9D3DF1C1B91AD11008561EB /* Base */, - 412C88001E253A1B00693041 /* fa */, ); name = LaunchScreen.storyboard; sourceTree = ""; @@ -662,7 +657,6 @@ isa = PBXVariantGroup; children = ( C9DC07FB1B90D0A3007A4DD0 /* en */, - 412C88071E253A1C00693041 /* fa */, ); name = PasscodeLock.strings; sourceTree = ""; From 4ee3bdbc6c17630c06fae1900c3a503ff347d892 Mon Sep 17 00:00:00 2001 From: Ali Zahedi Date: Tue, 9 May 2017 15:54:30 +0430 Subject: [PATCH 4/5] Persian Language --- PasscodeLock/en.lproj/PasscodeLock.strings | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/PasscodeLock/en.lproj/PasscodeLock.strings b/PasscodeLock/en.lproj/PasscodeLock.strings index f71ef86c..3d991b22 100755 --- a/PasscodeLock/en.lproj/PasscodeLock.strings +++ b/PasscodeLock/en.lproj/PasscodeLock.strings @@ -7,27 +7,27 @@ */ /* Enter Passcode State */ -"PasscodeLockEnterTitle" = "Enter Passcode"; -"PasscodeLockEnterDescription" = "Enter your passcode to proceed."; +"PasscodeLockEnterTitle" = "رمز عبور"; +"PasscodeLockEnterDescription" = "رمز عبور را وارد نمایید"; /* Set Passcode State */ -"PasscodeLockSetTitle" = "Enter a Passcode"; -"PasscodeLockSetDescription" = "Choose your passcode."; +"PasscodeLockSetTitle" = "رمز عبور"; +"PasscodeLockSetDescription" = "رمز عبور خود را انتخاب کنید"; /* Confirm Passcode State */ -"PasscodeLockConfirmTitle" = "Confirm Passcode"; -"PasscodeLockConfirmDescription" = "Enter the passcode again."; +"PasscodeLockConfirmTitle" = "تایید رمز عبور"; +"PasscodeLockConfirmDescription" = "رمز عبور خود را مجدد وارد نماید"; /* Change Passcode State */ -"PasscodeLockChangeTitle" = "Enter Old Passcode"; -"PasscodeLockChangeDescription" = "Enter your old passcode."; +"PasscodeLockChangeTitle" = "رمز عبور قدیم"; +"PasscodeLockChangeDescription" = "رمز عبور قدیم خود را وارد نمایید."; /* Passcode Mismatch State */ -"PasscodeLockMismatchTitle" = "Try again"; -"PasscodeLockMismatchDescription" = "Passcodes didn\'t match."; +"PasscodeLockMismatchTitle" = "دوباره تلاش کنید"; +"PasscodeLockMismatchDescription" = "رمز عبورها یکسان نیستند."; /* Touch ID Reason */ -"PasscodeLockTouchIDReason" = "Authentication required to proceed"; +"PasscodeLockTouchIDReason" = "اعتبار سنجی بیومتریک"; /* Touch ID Fallback Button */ -"PasscodeLockTouchIDButton" = "Enter Passcode"; \ No newline at end of file +"PasscodeLockTouchIDButton" = "رمز عبور"; From 7a3d8033843b6977e12e0dece57f123727e82da3 Mon Sep 17 00:00:00 2001 From: Ali Zahedi Date: Mon, 12 Jun 2017 17:25:27 +0430 Subject: [PATCH 5/5] update passcode to Xcode 8.3.3 --- PasscodeLock/PasscodeLockViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PasscodeLock/PasscodeLockViewController.swift b/PasscodeLock/PasscodeLockViewController.swift index 622f488a..f013de45 100644 --- a/PasscodeLock/PasscodeLockViewController.swift +++ b/PasscodeLock/PasscodeLockViewController.swift @@ -41,7 +41,7 @@ open class PasscodeLockViewController: UIViewController, PasscodeLockTypeDelegat open var notificationCenter: NotificationCenter? internal let passcodeConfiguration: PasscodeLockConfigurationType - internal let passcodeLock: PasscodeLockType + internal var passcodeLock: PasscodeLockType internal var isPlaceholdersAnimationCompleted = true fileprivate var shouldTryToAuthenticateWithBiometrics = true