├── .travis.yml ├── Example ├── Podfile ├── Tests │ ├── Info.plist │ └── Tests.swift ├── UXPasscodeField.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── UXPasscodeField-Example.xcscheme └── UXPasscodeField │ ├── AppDelegate.swift │ ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard │ ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Info.plist │ ├── TableViewController.swift │ └── ViewController.swift ├── LICENSE ├── README.md ├── Screenshot.gif ├── UXPasscodeField.podspec ├── UXPasscodeField ├── Assets │ └── .gitkeep ├── Classes │ ├── .gitkeep │ ├── UXPasscodeField.swift │ └── UXPasscodeViewController.swift └── Resources │ └── UXPasscodeViewController.storyboard └── _Pods.xcodeproj /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | osx_image: xcode7.3 6 | language: objective-c 7 | # cache: cocoapods 8 | # podfile: Example/Podfile 9 | # before_install: 10 | # - gem install cocoapods # Since Travis is not always on latest version 11 | # - pod install --project-directory=Example 12 | script: 13 | - set -o pipefail && xcodebuild test -workspace Example/UXPasscodeField.xcworkspace -scheme UXPasscodeField-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty 14 | - pod lib lint 15 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | target 'UXPasscodeField_Example' do 4 | pod 'UXPasscodeField', :path => '../' 5 | 6 | target 'UXPasscodeField_Tests' do 7 | inherit! :search_paths 8 | 9 | 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /Example/Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Tests/Tests.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import XCTest 3 | import UXPasscodeField 4 | 5 | class Tests: XCTestCase { 6 | 7 | override func setUp() { 8 | super.setUp() 9 | // Put setup code here. This method is called before the invocation of each test method in the class. 10 | } 11 | 12 | override func tearDown() { 13 | // Put teardown code here. This method is called after the invocation of each test method in the class. 14 | super.tearDown() 15 | } 16 | 17 | func testExample() { 18 | // This is an example of a functional test case. 19 | XCTAssert(true, "Pass") 20 | } 21 | 22 | func testPerformanceExample() { 23 | // This is an example of a performance test case. 24 | self.measure() { 25 | // Put the code you want to measure the time of here. 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /Example/UXPasscodeField.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2C47F6171E09E591001E25D6 /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C47F6161E09E591001E25D6 /* TableViewController.swift */; }; 11 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; 12 | 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; }; 13 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; 14 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; 15 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; 16 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; }; 17 | E5F0F6D8FAFB33C0315BB749 /* Pods_UXPasscodeField_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 82D90C05D01D310C490A625E /* Pods_UXPasscodeField_Example.framework */; }; 18 | F4FC1AEFE5515A2972C0536A /* Pods_UXPasscodeField_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B07969CED293B1634B69CB5 /* Pods_UXPasscodeField_Tests.framework */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 607FACC81AFB9204008FA782 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 607FACCF1AFB9204008FA782; 27 | remoteInfo = UXPasscodeField; 28 | }; 29 | /* End PBXContainerItemProxy section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 0D907B6CF5FCEAD70027FB2A /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 33 | 2C47F6161E09E591001E25D6 /* TableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = ""; }; 34 | 3B07969CED293B1634B69CB5 /* Pods_UXPasscodeField_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_UXPasscodeField_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | 607FACD01AFB9204008FA782 /* UXPasscodeField_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UXPasscodeField_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 37 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 38 | 607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 39 | 607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 40 | 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 41 | 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 42 | 607FACE51AFB9204008FA782 /* UXPasscodeField_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UXPasscodeField_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | 607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; }; 45 | 665E7C61C7F6492FBBA22834 /* UXPasscodeField.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = UXPasscodeField.podspec; path = ../UXPasscodeField.podspec; sourceTree = ""; }; 46 | 68061D3255A4ADAA27A0D6C7 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 47 | 82D90C05D01D310C490A625E /* Pods_UXPasscodeField_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_UXPasscodeField_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 9CC6C6EA985CF18780B99127 /* Pods-UXPasscodeField_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UXPasscodeField_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-UXPasscodeField_Tests/Pods-UXPasscodeField_Tests.debug.xcconfig"; sourceTree = ""; }; 49 | D7F73A71C6CF16274AF8F41B /* Pods-UXPasscodeField_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UXPasscodeField_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-UXPasscodeField_Example/Pods-UXPasscodeField_Example.release.xcconfig"; sourceTree = ""; }; 50 | E833389E5FAD2697CA36D301 /* Pods-UXPasscodeField_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UXPasscodeField_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-UXPasscodeField_Example/Pods-UXPasscodeField_Example.debug.xcconfig"; sourceTree = ""; }; 51 | EFEA12444C398EC2B0075BF3 /* Pods-UXPasscodeField_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UXPasscodeField_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-UXPasscodeField_Tests/Pods-UXPasscodeField_Tests.release.xcconfig"; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | 607FACCD1AFB9204008FA782 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | E5F0F6D8FAFB33C0315BB749 /* Pods_UXPasscodeField_Example.framework in Frameworks */, 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | 607FACE21AFB9204008FA782 /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | F4FC1AEFE5515A2972C0536A /* Pods_UXPasscodeField_Tests.framework in Frameworks */, 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | /* End PBXFrameworksBuildPhase section */ 72 | 73 | /* Begin PBXGroup section */ 74 | 607FACC71AFB9204008FA782 = { 75 | isa = PBXGroup; 76 | children = ( 77 | 607FACF51AFB993E008FA782 /* Podspec Metadata */, 78 | 607FACD21AFB9204008FA782 /* Example for UXPasscodeField */, 79 | 607FACE81AFB9204008FA782 /* Tests */, 80 | 607FACD11AFB9204008FA782 /* Products */, 81 | C4F4216FACD4F6DF3A40D7D3 /* Pods */, 82 | D66FE22FF8D827F903D29815 /* Frameworks */, 83 | ); 84 | sourceTree = ""; 85 | }; 86 | 607FACD11AFB9204008FA782 /* Products */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 607FACD01AFB9204008FA782 /* UXPasscodeField_Example.app */, 90 | 607FACE51AFB9204008FA782 /* UXPasscodeField_Tests.xctest */, 91 | ); 92 | name = Products; 93 | sourceTree = ""; 94 | }; 95 | 607FACD21AFB9204008FA782 /* Example for UXPasscodeField */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */, 99 | 2C47F6161E09E591001E25D6 /* TableViewController.swift */, 100 | 607FACD71AFB9204008FA782 /* ViewController.swift */, 101 | 607FACD91AFB9204008FA782 /* Main.storyboard */, 102 | 607FACDC1AFB9204008FA782 /* Images.xcassets */, 103 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */, 104 | 607FACD31AFB9204008FA782 /* Supporting Files */, 105 | ); 106 | name = "Example for UXPasscodeField"; 107 | path = UXPasscodeField; 108 | sourceTree = ""; 109 | }; 110 | 607FACD31AFB9204008FA782 /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 607FACD41AFB9204008FA782 /* Info.plist */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | 607FACE81AFB9204008FA782 /* Tests */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 607FACEB1AFB9204008FA782 /* Tests.swift */, 122 | 607FACE91AFB9204008FA782 /* Supporting Files */, 123 | ); 124 | path = Tests; 125 | sourceTree = ""; 126 | }; 127 | 607FACE91AFB9204008FA782 /* Supporting Files */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 607FACEA1AFB9204008FA782 /* Info.plist */, 131 | ); 132 | name = "Supporting Files"; 133 | sourceTree = ""; 134 | }; 135 | 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | 665E7C61C7F6492FBBA22834 /* UXPasscodeField.podspec */, 139 | 68061D3255A4ADAA27A0D6C7 /* README.md */, 140 | 0D907B6CF5FCEAD70027FB2A /* LICENSE */, 141 | ); 142 | name = "Podspec Metadata"; 143 | sourceTree = ""; 144 | }; 145 | C4F4216FACD4F6DF3A40D7D3 /* Pods */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | E833389E5FAD2697CA36D301 /* Pods-UXPasscodeField_Example.debug.xcconfig */, 149 | D7F73A71C6CF16274AF8F41B /* Pods-UXPasscodeField_Example.release.xcconfig */, 150 | 9CC6C6EA985CF18780B99127 /* Pods-UXPasscodeField_Tests.debug.xcconfig */, 151 | EFEA12444C398EC2B0075BF3 /* Pods-UXPasscodeField_Tests.release.xcconfig */, 152 | ); 153 | name = Pods; 154 | sourceTree = ""; 155 | }; 156 | D66FE22FF8D827F903D29815 /* Frameworks */ = { 157 | isa = PBXGroup; 158 | children = ( 159 | 82D90C05D01D310C490A625E /* Pods_UXPasscodeField_Example.framework */, 160 | 3B07969CED293B1634B69CB5 /* Pods_UXPasscodeField_Tests.framework */, 161 | ); 162 | name = Frameworks; 163 | sourceTree = ""; 164 | }; 165 | /* End PBXGroup section */ 166 | 167 | /* Begin PBXNativeTarget section */ 168 | 607FACCF1AFB9204008FA782 /* UXPasscodeField_Example */ = { 169 | isa = PBXNativeTarget; 170 | buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "UXPasscodeField_Example" */; 171 | buildPhases = ( 172 | C8C2D04323A468A9974026F3 /* [CP] Check Pods Manifest.lock */, 173 | 607FACCC1AFB9204008FA782 /* Sources */, 174 | 607FACCD1AFB9204008FA782 /* Frameworks */, 175 | 607FACCE1AFB9204008FA782 /* Resources */, 176 | 683B4BD7F22BC7340E5EA82D /* [CP] Embed Pods Frameworks */, 177 | 43A413FDC5A206CC4B2D3D4E /* [CP] Copy Pods Resources */, 178 | ); 179 | buildRules = ( 180 | ); 181 | dependencies = ( 182 | ); 183 | name = UXPasscodeField_Example; 184 | productName = UXPasscodeField; 185 | productReference = 607FACD01AFB9204008FA782 /* UXPasscodeField_Example.app */; 186 | productType = "com.apple.product-type.application"; 187 | }; 188 | 607FACE41AFB9204008FA782 /* UXPasscodeField_Tests */ = { 189 | isa = PBXNativeTarget; 190 | buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "UXPasscodeField_Tests" */; 191 | buildPhases = ( 192 | 49465F06E52CA56A852430E3 /* [CP] Check Pods Manifest.lock */, 193 | 607FACE11AFB9204008FA782 /* Sources */, 194 | 607FACE21AFB9204008FA782 /* Frameworks */, 195 | 607FACE31AFB9204008FA782 /* Resources */, 196 | 2BCA44F423263F57B2611F48 /* [CP] Embed Pods Frameworks */, 197 | 2EF12DEA98486123739CDE1A /* [CP] Copy Pods Resources */, 198 | ); 199 | buildRules = ( 200 | ); 201 | dependencies = ( 202 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */, 203 | ); 204 | name = UXPasscodeField_Tests; 205 | productName = Tests; 206 | productReference = 607FACE51AFB9204008FA782 /* UXPasscodeField_Tests.xctest */; 207 | productType = "com.apple.product-type.bundle.unit-test"; 208 | }; 209 | /* End PBXNativeTarget section */ 210 | 211 | /* Begin PBXProject section */ 212 | 607FACC81AFB9204008FA782 /* Project object */ = { 213 | isa = PBXProject; 214 | attributes = { 215 | LastSwiftUpdateCheck = 0720; 216 | LastUpgradeCheck = 0820; 217 | ORGANIZATIONNAME = CocoaPods; 218 | TargetAttributes = { 219 | 607FACCF1AFB9204008FA782 = { 220 | CreatedOnToolsVersion = 6.3.1; 221 | LastSwiftMigration = 0820; 222 | }; 223 | 607FACE41AFB9204008FA782 = { 224 | CreatedOnToolsVersion = 6.3.1; 225 | LastSwiftMigration = 0820; 226 | TestTargetID = 607FACCF1AFB9204008FA782; 227 | }; 228 | }; 229 | }; 230 | buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "UXPasscodeField" */; 231 | compatibilityVersion = "Xcode 3.2"; 232 | developmentRegion = English; 233 | hasScannedForEncodings = 0; 234 | knownRegions = ( 235 | en, 236 | Base, 237 | ); 238 | mainGroup = 607FACC71AFB9204008FA782; 239 | productRefGroup = 607FACD11AFB9204008FA782 /* Products */; 240 | projectDirPath = ""; 241 | projectRoot = ""; 242 | targets = ( 243 | 607FACCF1AFB9204008FA782 /* UXPasscodeField_Example */, 244 | 607FACE41AFB9204008FA782 /* UXPasscodeField_Tests */, 245 | ); 246 | }; 247 | /* End PBXProject section */ 248 | 249 | /* Begin PBXResourcesBuildPhase section */ 250 | 607FACCE1AFB9204008FA782 /* Resources */ = { 251 | isa = PBXResourcesBuildPhase; 252 | buildActionMask = 2147483647; 253 | files = ( 254 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */, 255 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */, 256 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | }; 260 | 607FACE31AFB9204008FA782 /* Resources */ = { 261 | isa = PBXResourcesBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | }; 267 | /* End PBXResourcesBuildPhase section */ 268 | 269 | /* Begin PBXShellScriptBuildPhase section */ 270 | 2BCA44F423263F57B2611F48 /* [CP] Embed Pods Frameworks */ = { 271 | isa = PBXShellScriptBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | ); 275 | inputPaths = ( 276 | ); 277 | name = "[CP] Embed Pods Frameworks"; 278 | outputPaths = ( 279 | ); 280 | runOnlyForDeploymentPostprocessing = 0; 281 | shellPath = /bin/sh; 282 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-UXPasscodeField_Tests/Pods-UXPasscodeField_Tests-frameworks.sh\"\n"; 283 | showEnvVarsInLog = 0; 284 | }; 285 | 2EF12DEA98486123739CDE1A /* [CP] Copy Pods Resources */ = { 286 | isa = PBXShellScriptBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | ); 290 | inputPaths = ( 291 | ); 292 | name = "[CP] Copy Pods Resources"; 293 | outputPaths = ( 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | shellPath = /bin/sh; 297 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-UXPasscodeField_Tests/Pods-UXPasscodeField_Tests-resources.sh\"\n"; 298 | showEnvVarsInLog = 0; 299 | }; 300 | 43A413FDC5A206CC4B2D3D4E /* [CP] Copy Pods Resources */ = { 301 | isa = PBXShellScriptBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | ); 305 | inputPaths = ( 306 | ); 307 | name = "[CP] Copy Pods Resources"; 308 | outputPaths = ( 309 | ); 310 | runOnlyForDeploymentPostprocessing = 0; 311 | shellPath = /bin/sh; 312 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-UXPasscodeField_Example/Pods-UXPasscodeField_Example-resources.sh\"\n"; 313 | showEnvVarsInLog = 0; 314 | }; 315 | 49465F06E52CA56A852430E3 /* [CP] Check Pods Manifest.lock */ = { 316 | isa = PBXShellScriptBuildPhase; 317 | buildActionMask = 2147483647; 318 | files = ( 319 | ); 320 | inputPaths = ( 321 | ); 322 | name = "[CP] Check Pods Manifest.lock"; 323 | outputPaths = ( 324 | ); 325 | runOnlyForDeploymentPostprocessing = 0; 326 | shellPath = /bin/sh; 327 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 328 | showEnvVarsInLog = 0; 329 | }; 330 | 683B4BD7F22BC7340E5EA82D /* [CP] Embed Pods Frameworks */ = { 331 | isa = PBXShellScriptBuildPhase; 332 | buildActionMask = 2147483647; 333 | files = ( 334 | ); 335 | inputPaths = ( 336 | ); 337 | name = "[CP] Embed Pods Frameworks"; 338 | outputPaths = ( 339 | ); 340 | runOnlyForDeploymentPostprocessing = 0; 341 | shellPath = /bin/sh; 342 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-UXPasscodeField_Example/Pods-UXPasscodeField_Example-frameworks.sh\"\n"; 343 | showEnvVarsInLog = 0; 344 | }; 345 | C8C2D04323A468A9974026F3 /* [CP] Check Pods Manifest.lock */ = { 346 | isa = PBXShellScriptBuildPhase; 347 | buildActionMask = 2147483647; 348 | files = ( 349 | ); 350 | inputPaths = ( 351 | ); 352 | name = "[CP] Check Pods Manifest.lock"; 353 | outputPaths = ( 354 | ); 355 | runOnlyForDeploymentPostprocessing = 0; 356 | shellPath = /bin/sh; 357 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 358 | showEnvVarsInLog = 0; 359 | }; 360 | /* End PBXShellScriptBuildPhase section */ 361 | 362 | /* Begin PBXSourcesBuildPhase section */ 363 | 607FACCC1AFB9204008FA782 /* Sources */ = { 364 | isa = PBXSourcesBuildPhase; 365 | buildActionMask = 2147483647; 366 | files = ( 367 | 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */, 368 | 2C47F6171E09E591001E25D6 /* TableViewController.swift in Sources */, 369 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */, 370 | ); 371 | runOnlyForDeploymentPostprocessing = 0; 372 | }; 373 | 607FACE11AFB9204008FA782 /* Sources */ = { 374 | isa = PBXSourcesBuildPhase; 375 | buildActionMask = 2147483647; 376 | files = ( 377 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */, 378 | ); 379 | runOnlyForDeploymentPostprocessing = 0; 380 | }; 381 | /* End PBXSourcesBuildPhase section */ 382 | 383 | /* Begin PBXTargetDependency section */ 384 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */ = { 385 | isa = PBXTargetDependency; 386 | target = 607FACCF1AFB9204008FA782 /* UXPasscodeField_Example */; 387 | targetProxy = 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */; 388 | }; 389 | /* End PBXTargetDependency section */ 390 | 391 | /* Begin PBXVariantGroup section */ 392 | 607FACD91AFB9204008FA782 /* Main.storyboard */ = { 393 | isa = PBXVariantGroup; 394 | children = ( 395 | 607FACDA1AFB9204008FA782 /* Base */, 396 | ); 397 | name = Main.storyboard; 398 | sourceTree = ""; 399 | }; 400 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = { 401 | isa = PBXVariantGroup; 402 | children = ( 403 | 607FACDF1AFB9204008FA782 /* Base */, 404 | ); 405 | name = LaunchScreen.xib; 406 | sourceTree = ""; 407 | }; 408 | /* End PBXVariantGroup section */ 409 | 410 | /* Begin XCBuildConfiguration section */ 411 | 607FACED1AFB9204008FA782 /* Debug */ = { 412 | isa = XCBuildConfiguration; 413 | buildSettings = { 414 | ALWAYS_SEARCH_USER_PATHS = NO; 415 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 416 | CLANG_CXX_LIBRARY = "libc++"; 417 | CLANG_ENABLE_MODULES = YES; 418 | CLANG_ENABLE_OBJC_ARC = YES; 419 | CLANG_WARN_BOOL_CONVERSION = YES; 420 | CLANG_WARN_CONSTANT_CONVERSION = YES; 421 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 422 | CLANG_WARN_EMPTY_BODY = YES; 423 | CLANG_WARN_ENUM_CONVERSION = YES; 424 | CLANG_WARN_INFINITE_RECURSION = YES; 425 | CLANG_WARN_INT_CONVERSION = YES; 426 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 427 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 428 | CLANG_WARN_UNREACHABLE_CODE = YES; 429 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 430 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 431 | COPY_PHASE_STRIP = NO; 432 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 433 | ENABLE_STRICT_OBJC_MSGSEND = YES; 434 | ENABLE_TESTABILITY = YES; 435 | GCC_C_LANGUAGE_STANDARD = gnu99; 436 | GCC_DYNAMIC_NO_PIC = NO; 437 | GCC_NO_COMMON_BLOCKS = YES; 438 | GCC_OPTIMIZATION_LEVEL = 0; 439 | GCC_PREPROCESSOR_DEFINITIONS = ( 440 | "DEBUG=1", 441 | "$(inherited)", 442 | ); 443 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 444 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 445 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 446 | GCC_WARN_UNDECLARED_SELECTOR = YES; 447 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 448 | GCC_WARN_UNUSED_FUNCTION = YES; 449 | GCC_WARN_UNUSED_VARIABLE = YES; 450 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 451 | MTL_ENABLE_DEBUG_INFO = YES; 452 | ONLY_ACTIVE_ARCH = YES; 453 | SDKROOT = iphoneos; 454 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 455 | }; 456 | name = Debug; 457 | }; 458 | 607FACEE1AFB9204008FA782 /* Release */ = { 459 | isa = XCBuildConfiguration; 460 | buildSettings = { 461 | ALWAYS_SEARCH_USER_PATHS = NO; 462 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 463 | CLANG_CXX_LIBRARY = "libc++"; 464 | CLANG_ENABLE_MODULES = YES; 465 | CLANG_ENABLE_OBJC_ARC = YES; 466 | CLANG_WARN_BOOL_CONVERSION = YES; 467 | CLANG_WARN_CONSTANT_CONVERSION = YES; 468 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 469 | CLANG_WARN_EMPTY_BODY = YES; 470 | CLANG_WARN_ENUM_CONVERSION = YES; 471 | CLANG_WARN_INFINITE_RECURSION = YES; 472 | CLANG_WARN_INT_CONVERSION = YES; 473 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 474 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 475 | CLANG_WARN_UNREACHABLE_CODE = YES; 476 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 477 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 478 | COPY_PHASE_STRIP = NO; 479 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 480 | ENABLE_NS_ASSERTIONS = NO; 481 | ENABLE_STRICT_OBJC_MSGSEND = YES; 482 | GCC_C_LANGUAGE_STANDARD = gnu99; 483 | GCC_NO_COMMON_BLOCKS = YES; 484 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 485 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 486 | GCC_WARN_UNDECLARED_SELECTOR = YES; 487 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 488 | GCC_WARN_UNUSED_FUNCTION = YES; 489 | GCC_WARN_UNUSED_VARIABLE = YES; 490 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 491 | MTL_ENABLE_DEBUG_INFO = NO; 492 | SDKROOT = iphoneos; 493 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 494 | VALIDATE_PRODUCT = YES; 495 | }; 496 | name = Release; 497 | }; 498 | 607FACF01AFB9204008FA782 /* Debug */ = { 499 | isa = XCBuildConfiguration; 500 | baseConfigurationReference = E833389E5FAD2697CA36D301 /* Pods-UXPasscodeField_Example.debug.xcconfig */; 501 | buildSettings = { 502 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 503 | INFOPLIST_FILE = UXPasscodeField/Info.plist; 504 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 505 | MODULE_NAME = ExampleApp; 506 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; 507 | PRODUCT_NAME = "$(TARGET_NAME)"; 508 | SWIFT_VERSION = 3.0; 509 | }; 510 | name = Debug; 511 | }; 512 | 607FACF11AFB9204008FA782 /* Release */ = { 513 | isa = XCBuildConfiguration; 514 | baseConfigurationReference = D7F73A71C6CF16274AF8F41B /* Pods-UXPasscodeField_Example.release.xcconfig */; 515 | buildSettings = { 516 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 517 | INFOPLIST_FILE = UXPasscodeField/Info.plist; 518 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 519 | MODULE_NAME = ExampleApp; 520 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; 521 | PRODUCT_NAME = "$(TARGET_NAME)"; 522 | SWIFT_VERSION = 3.0; 523 | }; 524 | name = Release; 525 | }; 526 | 607FACF31AFB9204008FA782 /* Debug */ = { 527 | isa = XCBuildConfiguration; 528 | baseConfigurationReference = 9CC6C6EA985CF18780B99127 /* Pods-UXPasscodeField_Tests.debug.xcconfig */; 529 | buildSettings = { 530 | FRAMEWORK_SEARCH_PATHS = ( 531 | "$(SDKROOT)/Developer/Library/Frameworks", 532 | "$(inherited)", 533 | ); 534 | GCC_PREPROCESSOR_DEFINITIONS = ( 535 | "DEBUG=1", 536 | "$(inherited)", 537 | ); 538 | INFOPLIST_FILE = Tests/Info.plist; 539 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 540 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 541 | PRODUCT_NAME = "$(TARGET_NAME)"; 542 | SWIFT_VERSION = 3.0; 543 | }; 544 | name = Debug; 545 | }; 546 | 607FACF41AFB9204008FA782 /* Release */ = { 547 | isa = XCBuildConfiguration; 548 | baseConfigurationReference = EFEA12444C398EC2B0075BF3 /* Pods-UXPasscodeField_Tests.release.xcconfig */; 549 | buildSettings = { 550 | FRAMEWORK_SEARCH_PATHS = ( 551 | "$(SDKROOT)/Developer/Library/Frameworks", 552 | "$(inherited)", 553 | ); 554 | INFOPLIST_FILE = Tests/Info.plist; 555 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 556 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 557 | PRODUCT_NAME = "$(TARGET_NAME)"; 558 | SWIFT_VERSION = 3.0; 559 | }; 560 | name = Release; 561 | }; 562 | /* End XCBuildConfiguration section */ 563 | 564 | /* Begin XCConfigurationList section */ 565 | 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "UXPasscodeField" */ = { 566 | isa = XCConfigurationList; 567 | buildConfigurations = ( 568 | 607FACED1AFB9204008FA782 /* Debug */, 569 | 607FACEE1AFB9204008FA782 /* Release */, 570 | ); 571 | defaultConfigurationIsVisible = 0; 572 | defaultConfigurationName = Release; 573 | }; 574 | 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "UXPasscodeField_Example" */ = { 575 | isa = XCConfigurationList; 576 | buildConfigurations = ( 577 | 607FACF01AFB9204008FA782 /* Debug */, 578 | 607FACF11AFB9204008FA782 /* Release */, 579 | ); 580 | defaultConfigurationIsVisible = 0; 581 | defaultConfigurationName = Release; 582 | }; 583 | 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "UXPasscodeField_Tests" */ = { 584 | isa = XCConfigurationList; 585 | buildConfigurations = ( 586 | 607FACF31AFB9204008FA782 /* Debug */, 587 | 607FACF41AFB9204008FA782 /* Release */, 588 | ); 589 | defaultConfigurationIsVisible = 0; 590 | defaultConfigurationName = Release; 591 | }; 592 | /* End XCConfigurationList section */ 593 | }; 594 | rootObject = 607FACC81AFB9204008FA782 /* Project object */; 595 | } 596 | -------------------------------------------------------------------------------- /Example/UXPasscodeField.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/UXPasscodeField.xcodeproj/xcshareddata/xcschemes/UXPasscodeField-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 78 | 80 | 86 | 87 | 88 | 89 | 90 | 91 | 97 | 99 | 105 | 106 | 107 | 108 | 110 | 111 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /Example/UXPasscodeField/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // UXPasscodeField 4 | // 5 | // Created by Eddie Lau on 12/19/2016. 6 | // Copyright (c) 2016 Eddie Lau. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | func applicationWillResignActive(_ application: UIApplication) { 22 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 23 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 24 | } 25 | 26 | func applicationDidEnterBackground(_ application: UIApplication) { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | func applicationWillEnterForeground(_ application: UIApplication) { 32 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 33 | } 34 | 35 | func applicationDidBecomeActive(_ application: UIApplication) { 36 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 37 | } 38 | 39 | func applicationWillTerminate(_ application: UIApplication) { 40 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 41 | } 42 | 43 | 44 | } 45 | 46 | -------------------------------------------------------------------------------- /Example/UXPasscodeField/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Example/UXPasscodeField/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /Example/UXPasscodeField/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | } 43 | ], 44 | "info" : { 45 | "version" : 1, 46 | "author" : "xcode" 47 | } 48 | } -------------------------------------------------------------------------------- /Example/UXPasscodeField/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Example/UXPasscodeField/TableViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewController.swift 3 | // UXPasscodeField 4 | // 5 | // Created by Eddie Hiu-Fung Lau on 21/12/2016. 6 | // Copyright © 2016 CocoaPods. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import UXPasscodeField 11 | 12 | class TableViewController: UITableViewController { 13 | 14 | lazy var passcodeViewController: UXPasscodeViewController = { 15 | 16 | let vc = UXPasscodeViewController.instantiate() 17 | vc.title = "Passcode" 18 | vc.message = "Hello iOS developer! Please input your 4-digit code here." 19 | vc.numberOfDigits = 4 20 | vc.done { passcode in 21 | 22 | print(passcode) 23 | _ = vc.resignFirstResponder() 24 | 25 | } 26 | 27 | return vc 28 | }() 29 | 30 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 31 | 32 | if indexPath.row == 1 { 33 | navigationController?.pushViewController(passcodeViewController, animated: true) 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Example/UXPasscodeField/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // UXPasscodeField 4 | // 5 | // Created by Eddie Lau on 12/19/2016. 6 | // Copyright (c) 2016 Eddie Lau. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import UXPasscodeField 11 | 12 | class ViewController: UIViewController { 13 | 14 | @IBOutlet weak var passcodeField: UXPasscodeField! 15 | @IBOutlet weak var isSecureSwitch: UISwitch! 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | 20 | isSecureSwitch.isOn = passcodeField.isSecureTextEntry 21 | passcodeField.becomeFirstResponder() 22 | 23 | // Optional, default is false 24 | passcodeField.isSecureTextEntry = false 25 | 26 | passcodeField.addTarget(self, action: #selector(ViewController.passcodeFieldDidChangeValue), for: .valueChanged) 27 | 28 | } 29 | 30 | @IBAction func passcodeFieldDidChangeValue() { 31 | print(passcodeField.passcode) 32 | } 33 | 34 | @IBAction func switchDidChangeValue() { 35 | passcodeField.isSecureTextEntry = isSecureSwitch.isOn 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Eddie Lau 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UXPasscodeField 2 | 3 | [![CI Status](http://img.shields.io/travis/Eddie Lau/UXPasscodeField.svg?style=flat)](https://travis-ci.org/Eddie Lau/UXPasscodeField) 4 | [![Version](https://img.shields.io/cocoapods/v/UXPasscodeField.svg?style=flat)](http://cocoapods.org/pods/UXPasscodeField) 5 | [![License](https://img.shields.io/cocoapods/l/UXPasscodeField.svg?style=flat)](http://cocoapods.org/pods/UXPasscodeField) 6 | [![Platform](https://img.shields.io/cocoapods/p/UXPasscodeField.svg?style=flat)](http://cocoapods.org/pods/UXPasscodeField) 7 | 8 | ## Screenshot 9 | 10 | ![Screenshot](./Screenshot.gif) 11 | 12 | ## Example Project 13 | 14 | To run the example project, clone the repo, and run `pod install` from the Example directory first. 15 | 16 | 17 | ## Sample Code 18 | 19 | ### UXPasscodeField 20 | ```swift 21 | import UIKit 22 | import UXPasscodeField 23 | 24 | class ViewController: UIViewController { 25 | 26 | @IBOutlet weak var passcodeField: UXPasscodeField! 27 | 28 | override func viewDidLoad() { 29 | super.viewDidLoad() 30 | 31 | passcodeField.becomeFirstResponder() 32 | 33 | // Optional, default is 6 34 | passcodeField.numberOfDigits = 6 35 | 36 | // Optional, default is false 37 | passcodeField.isSecureTextEntry = false 38 | 39 | passcodeField.addTarget( 40 | self, 41 | action: #selector(ViewController.passcodeFieldDidChangeValue), 42 | for: .valueChanged) 43 | 44 | } 45 | 46 | @IBAction func passcodeFieldDidChangeValue() { 47 | print(passcodeField.passcode) 48 | } 49 | 50 | } 51 | ``` 52 | ### UXPasscodeViewController 53 | ```swift 54 | let passcodeViewController = UXPasscodeViewController.instantiate() 55 | passcodeViewController.message = "Hello iOS developer! Please input your 4-digit code here." 56 | passcodeViewController.numberOfDigits = 4 57 | passcodeViewController.done { passcode in 58 | 59 | print(passcode) 60 | _ = passcodeViewController.resignFirstResponder() 61 | 62 | } 63 | ``` 64 | 65 | ## Requirements 66 | 67 | iOS 8 or above. 68 | 69 | ## Installation 70 | 71 | UXPasscodeField is available through [CocoaPods](http://cocoapods.org). To install 72 | it, simply add the following line to your Podfile: 73 | 74 | ```ruby 75 | pod "UXPasscodeField" 76 | ``` 77 | 78 | ## Author 79 | 80 | Eddie Lau, eddie@touchutility.com 81 | 82 | ## License 83 | 84 | UXPasscodeField is available under the MIT license. See the LICENSE file for more info. 85 | -------------------------------------------------------------------------------- /Screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddy-lau/UXPasscodeField/994ba9d5483ba90e9457032095964ded7132a83c/Screenshot.gif -------------------------------------------------------------------------------- /UXPasscodeField.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint UXPasscodeField.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'UXPasscodeField' 11 | s.version = '1.2.1' 12 | s.summary = 'UXPasscodeField is an input control for numeric code' 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | 20 | s.description = <<-DESC 21 | UXPasscodeField is designed for inputting numeric values. It can be used for inputting passcode, PIN, SMS-verification, etc. 22 | DESC 23 | 24 | s.homepage = 'https://github.com/eddy-lau/UXPasscodeField' 25 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' 26 | s.license = { :type => 'MIT', :file => 'LICENSE' } 27 | s.author = { 'Eddie Lau' => 'eddie@touchutility.com' } 28 | s.source = { :git => 'https://github.com/eddy-lau/UXPasscodeField.git', :tag => s.version.to_s } 29 | s.resource_bundle = { 'UXPasscodeField' => 'UXPasscodeField/Resources/*' } 30 | 31 | 32 | s.ios.deployment_target = '8.0' 33 | s.source_files = 'UXPasscodeField/Classes/**/*' 34 | 35 | end 36 | -------------------------------------------------------------------------------- /UXPasscodeField/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddy-lau/UXPasscodeField/994ba9d5483ba90e9457032095964ded7132a83c/UXPasscodeField/Assets/.gitkeep -------------------------------------------------------------------------------- /UXPasscodeField/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eddy-lau/UXPasscodeField/994ba9d5483ba90e9457032095964ded7132a83c/UXPasscodeField/Classes/.gitkeep -------------------------------------------------------------------------------- /UXPasscodeField/Classes/UXPasscodeField.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UXPasscodeField.swift 3 | // Pods 4 | // 5 | // Created by Eddie Hiu-Fung Lau on 19/12/2016. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | @IBDesignable 12 | public class UXPasscodeField: UIControl, UIKeyInput { 13 | 14 | // MARK: - Public variables 15 | @IBInspectable public var numberOfDigits: Int = 6 { 16 | didSet { 17 | 18 | if oldValue != numberOfDigits { 19 | 20 | if passcode.characters.count > numberOfDigits { 21 | let endOfString = passcode.index(passcode.startIndex, offsetBy: numberOfDigits) 22 | passcode = passcode.substring(to: endOfString) 23 | } 24 | 25 | relayout() 26 | redisplay() 27 | } 28 | 29 | } 30 | } 31 | 32 | @IBInspectable public var passcode: String = "" { 33 | didSet { 34 | 35 | if oldValue != passcode { 36 | 37 | guard passcode.characters.count <= numberOfDigits else { 38 | return 39 | } 40 | 41 | guard isNumeric(passcode) else { 42 | return 43 | } 44 | 45 | redisplay() 46 | sendActions(for: .valueChanged) 47 | 48 | } 49 | } 50 | } 51 | 52 | @IBInspectable public var spaceBetweenDigits: CGFloat = 10.0 { 53 | 54 | didSet { 55 | 56 | if oldValue != spaceBetweenDigits { 57 | 58 | relayout() 59 | redisplay() 60 | 61 | } 62 | } 63 | 64 | } 65 | 66 | @IBInspectable public var dashColor: UIColor = UIColor.gray { 67 | didSet { 68 | 69 | if oldValue != dashColor { 70 | redisplay() 71 | } 72 | 73 | } 74 | } 75 | 76 | @IBInspectable public var textColor: UIColor = UIColor.black { 77 | didSet { 78 | if oldValue != textColor { 79 | redisplay() 80 | } 81 | } 82 | } 83 | 84 | // MARK: - Private variables 85 | private var numberLabels: [UILabel] = [] 86 | private let emptyDigit = "–" 87 | private var isSecure = false { 88 | didSet { 89 | if isSecure != oldValue { 90 | redisplay() 91 | } 92 | } 93 | } 94 | 95 | 96 | // MARK: - UIView 97 | override init(frame: CGRect) { 98 | super.init(frame: frame) 99 | setup() 100 | } 101 | 102 | required public init?(coder aDecoder: NSCoder) { 103 | super.init(coder: aDecoder) 104 | setup() 105 | } 106 | 107 | override public func layoutSubviews() { 108 | 109 | for index in 0.. CGRect { 148 | 149 | let w = (bounds.size.width - spaceBetweenDigits * (CGFloat(numberOfDigits) - 1.0)) / CGFloat(numberOfDigits) 150 | let h = bounds.size.height 151 | let x = (w + spaceBetweenDigits) * CGFloat(index) 152 | let y = CGFloat(0) 153 | return CGRect(x:x, y:y, width:w, height:h) 154 | 155 | } 156 | 157 | private func redisplay() { 158 | 159 | for i in 0.. Bool { 181 | 182 | guard let regex = try? NSRegularExpression(pattern: "^[0-9]*$", options: []) else { 183 | return false 184 | } 185 | 186 | return regex.numberOfMatches(in: string, options: [], range: NSMakeRange(0, string.characters.count)) == 1 187 | } 188 | 189 | // MARK: - Handle the touch up event 190 | @objc private func didTouchUpInside() { 191 | becomeFirstResponder() 192 | } 193 | 194 | // MARK: UIKeyInput protocol 195 | public var hasText: Bool { 196 | return !passcode.isEmpty 197 | } 198 | 199 | public func insertText(_ text: String) { 200 | 201 | guard passcode.characters.count + text.characters.count <= numberOfDigits else { 202 | return 203 | } 204 | 205 | guard isNumeric(text) else { 206 | return 207 | } 208 | 209 | passcode = passcode + text 210 | } 211 | 212 | public func deleteBackward() { 213 | guard passcode.characters.count > 0 else { 214 | return 215 | } 216 | passcode = passcode.substring(to: passcode.index(before: passcode.endIndex)) 217 | } 218 | 219 | public var isSecureTextEntry: Bool { 220 | @objc(isSecureTextEntry) get { 221 | return isSecure 222 | } 223 | @objc(setSecureTextEntry:) set { 224 | isSecure = newValue 225 | } 226 | } 227 | 228 | // MARK: UIResponder 229 | public override var canBecomeFirstResponder: Bool { 230 | return true 231 | } 232 | 233 | // MARK: UIKeyboardTrait 234 | 235 | public var keyboardType: UIKeyboardType { 236 | set {} 237 | get { 238 | return .numberPad 239 | } 240 | } 241 | 242 | 243 | } 244 | -------------------------------------------------------------------------------- /UXPasscodeField/Classes/UXPasscodeViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UXPasscodeViewController.swift 3 | // Pods 4 | // 5 | // Created by Eddie Hiu-Fung Lau on 20/12/2016. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | public class UXPasscodeViewController: UITableViewController { 12 | 13 | // MARK: - Public variables 14 | public var message: String? { 15 | didSet { 16 | if isViewLoaded { 17 | messageLabel.text = message 18 | } 19 | } 20 | } 21 | 22 | public var numberOfDigits = 6 { 23 | didSet { 24 | if isViewLoaded { 25 | passcodeField.numberOfDigits = numberOfDigits 26 | } 27 | } 28 | } 29 | 30 | // MARK: - Private variables 31 | @IBOutlet weak fileprivate var passcodeField: UXPasscodeField! 32 | @IBOutlet weak fileprivate var messageLabel: UILabel! 33 | fileprivate var doneAction: ((_ passcode:String)->Void)? 34 | 35 | // MARK: - UIViewController 36 | override public func viewDidLoad() { 37 | super.viewDidLoad() 38 | 39 | if let message = message { 40 | messageLabel.text = message 41 | } 42 | passcodeField.numberOfDigits = numberOfDigits 43 | 44 | passcodeField.becomeFirstResponder() 45 | } 46 | 47 | override public func didReceiveMemoryWarning() { 48 | super.didReceiveMemoryWarning() 49 | // Dispose of any resources that can be recreated. 50 | } 51 | 52 | public override func becomeFirstResponder() -> Bool { 53 | return passcodeField.becomeFirstResponder() 54 | } 55 | 56 | public override func resignFirstResponder() -> Bool { 57 | return passcodeField.resignFirstResponder() 58 | } 59 | 60 | } 61 | 62 | // MARK: - Public methods 63 | extension UXPasscodeViewController { 64 | 65 | public class func instantiate(message:String? = nil) -> UXPasscodeViewController { 66 | 67 | let bundle = Bundle(for:self) 68 | 69 | guard let resourceBundleURL = bundle.url(forResource: "UXPasscodeField", withExtension: "bundle") else { 70 | fatalError("Couldn't instantiate UXPasscodeViewController") 71 | } 72 | 73 | guard let resourceBundle = Bundle(url: resourceBundleURL) else { 74 | fatalError("Couldn't instantiate UXPasscodeViewController") 75 | } 76 | 77 | let storyboard = UIStoryboard(name: "UXPasscodeViewController", bundle: resourceBundle) 78 | guard let viewController = storyboard.instantiateInitialViewController() as? UXPasscodeViewController else { 79 | fatalError("Couldn't instantiate UXPasscodeViewController") 80 | } 81 | 82 | viewController.message = message 83 | return viewController 84 | } 85 | 86 | public func done(action: @escaping (_ passcode:String)->Void) { 87 | doneAction = action 88 | } 89 | 90 | } 91 | 92 | // MARK: - Private methods 93 | extension UXPasscodeViewController { 94 | 95 | @IBAction fileprivate func passcodeFieldValueDidChange() { 96 | 97 | if passcodeField.passcode.characters.count == passcodeField.numberOfDigits { 98 | doneAction?(passcodeField.passcode) 99 | } 100 | 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /UXPasscodeField/Resources/UXPasscodeViewController.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj --------------------------------------------------------------------------------