├── .DS_Store ├── CodeView_OC_Demo ├── .DS_Store └── CodeView │ ├── .DS_Store │ ├── CodeView.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── zksz.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── zksz.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ └── xcschememanagement.plist │ ├── CodeView │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── CodeView │ │ ├── CodeView.h │ │ └── CodeView.m │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m │ ├── CodeViewTests │ ├── CodeViewTests.m │ └── Info.plist │ └── CodeViewUITests │ ├── CodeViewUITests.m │ └── Info.plist ├── CodeView_Swift_Demo ├── .DS_Store ├── CodeView.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── zksz.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── zksz.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── CodeView │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── CodeView │ │ └── CodeView.swift │ ├── Info.plist │ └── ViewController.swift ├── CodeViewTests │ ├── CodeViewTests.swift │ └── Info.plist └── CodeViewUITests │ ├── CodeViewUITests.swift │ └── Info.plist ├── README.md └── Screenshot ├── .DS_Store ├── border.png └── line.png /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamXZP/CodeView/728f2f4e825832da02efa595a86a1d0d2a713225/.DS_Store -------------------------------------------------------------------------------- /CodeView_OC_Demo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamXZP/CodeView/728f2f4e825832da02efa595a86a1d0d2a713225/CodeView_OC_Demo/.DS_Store -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamXZP/CodeView/728f2f4e825832da02efa595a86a1d0d2a713225/CodeView_OC_Demo/CodeView/.DS_Store -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9CABFD6A2328FD0E00A53AF4 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CABFD692328FD0E00A53AF4 /* AppDelegate.m */; }; 11 | 9CABFD6D2328FD0E00A53AF4 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CABFD6C2328FD0E00A53AF4 /* ViewController.m */; }; 12 | 9CABFD702328FD0E00A53AF4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9CABFD6E2328FD0E00A53AF4 /* Main.storyboard */; }; 13 | 9CABFD722328FD0F00A53AF4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9CABFD712328FD0F00A53AF4 /* Assets.xcassets */; }; 14 | 9CABFD752328FD0F00A53AF4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9CABFD732328FD0F00A53AF4 /* LaunchScreen.storyboard */; }; 15 | 9CABFD782328FD0F00A53AF4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CABFD772328FD0F00A53AF4 /* main.m */; }; 16 | 9CABFD822328FD0F00A53AF4 /* CodeViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CABFD812328FD0F00A53AF4 /* CodeViewTests.m */; }; 17 | 9CABFD8D2328FD0F00A53AF4 /* CodeViewUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CABFD8C2328FD0F00A53AF4 /* CodeViewUITests.m */; }; 18 | 9CABFD9D2328FD4400A53AF4 /* CodeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CABFD9C2328FD4400A53AF4 /* CodeView.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 9CABFD7E2328FD0F00A53AF4 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 9CABFD5D2328FD0E00A53AF4 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 9CABFD642328FD0E00A53AF4; 27 | remoteInfo = CodeView; 28 | }; 29 | 9CABFD892328FD0F00A53AF4 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 9CABFD5D2328FD0E00A53AF4 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 9CABFD642328FD0E00A53AF4; 34 | remoteInfo = CodeView; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 9CABFD652328FD0E00A53AF4 /* CodeView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CodeView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 9CABFD682328FD0E00A53AF4 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 41 | 9CABFD692328FD0E00A53AF4 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 42 | 9CABFD6B2328FD0E00A53AF4 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 43 | 9CABFD6C2328FD0E00A53AF4 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 44 | 9CABFD6F2328FD0E00A53AF4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 45 | 9CABFD712328FD0F00A53AF4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 46 | 9CABFD742328FD0F00A53AF4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 47 | 9CABFD762328FD0F00A53AF4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | 9CABFD772328FD0F00A53AF4 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 49 | 9CABFD7D2328FD0F00A53AF4 /* CodeViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CodeViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 9CABFD812328FD0F00A53AF4 /* CodeViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CodeViewTests.m; sourceTree = ""; }; 51 | 9CABFD832328FD0F00A53AF4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | 9CABFD882328FD0F00A53AF4 /* CodeViewUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CodeViewUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 9CABFD8C2328FD0F00A53AF4 /* CodeViewUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CodeViewUITests.m; sourceTree = ""; }; 54 | 9CABFD8E2328FD0F00A53AF4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | 9CABFD9B2328FD4400A53AF4 /* CodeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CodeView.h; sourceTree = ""; }; 56 | 9CABFD9C2328FD4400A53AF4 /* CodeView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CodeView.m; sourceTree = ""; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | 9CABFD622328FD0E00A53AF4 /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | 9CABFD7A2328FD0F00A53AF4 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | 9CABFD852328FD0F00A53AF4 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | 9CABFD5C2328FD0E00A53AF4 = { 85 | isa = PBXGroup; 86 | children = ( 87 | 9CABFD672328FD0E00A53AF4 /* CodeView */, 88 | 9CABFD802328FD0F00A53AF4 /* CodeViewTests */, 89 | 9CABFD8B2328FD0F00A53AF4 /* CodeViewUITests */, 90 | 9CABFD662328FD0E00A53AF4 /* Products */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | 9CABFD662328FD0E00A53AF4 /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 9CABFD652328FD0E00A53AF4 /* CodeView.app */, 98 | 9CABFD7D2328FD0F00A53AF4 /* CodeViewTests.xctest */, 99 | 9CABFD882328FD0F00A53AF4 /* CodeViewUITests.xctest */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | 9CABFD672328FD0E00A53AF4 /* CodeView */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 9CABFD9A2328FD3100A53AF4 /* CodeView */, 108 | 9CABFD682328FD0E00A53AF4 /* AppDelegate.h */, 109 | 9CABFD692328FD0E00A53AF4 /* AppDelegate.m */, 110 | 9CABFD6B2328FD0E00A53AF4 /* ViewController.h */, 111 | 9CABFD6C2328FD0E00A53AF4 /* ViewController.m */, 112 | 9CABFD6E2328FD0E00A53AF4 /* Main.storyboard */, 113 | 9CABFD712328FD0F00A53AF4 /* Assets.xcassets */, 114 | 9CABFD732328FD0F00A53AF4 /* LaunchScreen.storyboard */, 115 | 9CABFD762328FD0F00A53AF4 /* Info.plist */, 116 | 9CABFD772328FD0F00A53AF4 /* main.m */, 117 | ); 118 | path = CodeView; 119 | sourceTree = ""; 120 | }; 121 | 9CABFD802328FD0F00A53AF4 /* CodeViewTests */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 9CABFD812328FD0F00A53AF4 /* CodeViewTests.m */, 125 | 9CABFD832328FD0F00A53AF4 /* Info.plist */, 126 | ); 127 | path = CodeViewTests; 128 | sourceTree = ""; 129 | }; 130 | 9CABFD8B2328FD0F00A53AF4 /* CodeViewUITests */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 9CABFD8C2328FD0F00A53AF4 /* CodeViewUITests.m */, 134 | 9CABFD8E2328FD0F00A53AF4 /* Info.plist */, 135 | ); 136 | path = CodeViewUITests; 137 | sourceTree = ""; 138 | }; 139 | 9CABFD9A2328FD3100A53AF4 /* CodeView */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 9CABFD9B2328FD4400A53AF4 /* CodeView.h */, 143 | 9CABFD9C2328FD4400A53AF4 /* CodeView.m */, 144 | ); 145 | path = CodeView; 146 | sourceTree = ""; 147 | }; 148 | /* End PBXGroup section */ 149 | 150 | /* Begin PBXNativeTarget section */ 151 | 9CABFD642328FD0E00A53AF4 /* CodeView */ = { 152 | isa = PBXNativeTarget; 153 | buildConfigurationList = 9CABFD912328FD0F00A53AF4 /* Build configuration list for PBXNativeTarget "CodeView" */; 154 | buildPhases = ( 155 | 9CABFD612328FD0E00A53AF4 /* Sources */, 156 | 9CABFD622328FD0E00A53AF4 /* Frameworks */, 157 | 9CABFD632328FD0E00A53AF4 /* Resources */, 158 | ); 159 | buildRules = ( 160 | ); 161 | dependencies = ( 162 | ); 163 | name = CodeView; 164 | productName = CodeView; 165 | productReference = 9CABFD652328FD0E00A53AF4 /* CodeView.app */; 166 | productType = "com.apple.product-type.application"; 167 | }; 168 | 9CABFD7C2328FD0F00A53AF4 /* CodeViewTests */ = { 169 | isa = PBXNativeTarget; 170 | buildConfigurationList = 9CABFD942328FD0F00A53AF4 /* Build configuration list for PBXNativeTarget "CodeViewTests" */; 171 | buildPhases = ( 172 | 9CABFD792328FD0F00A53AF4 /* Sources */, 173 | 9CABFD7A2328FD0F00A53AF4 /* Frameworks */, 174 | 9CABFD7B2328FD0F00A53AF4 /* Resources */, 175 | ); 176 | buildRules = ( 177 | ); 178 | dependencies = ( 179 | 9CABFD7F2328FD0F00A53AF4 /* PBXTargetDependency */, 180 | ); 181 | name = CodeViewTests; 182 | productName = CodeViewTests; 183 | productReference = 9CABFD7D2328FD0F00A53AF4 /* CodeViewTests.xctest */; 184 | productType = "com.apple.product-type.bundle.unit-test"; 185 | }; 186 | 9CABFD872328FD0F00A53AF4 /* CodeViewUITests */ = { 187 | isa = PBXNativeTarget; 188 | buildConfigurationList = 9CABFD972328FD0F00A53AF4 /* Build configuration list for PBXNativeTarget "CodeViewUITests" */; 189 | buildPhases = ( 190 | 9CABFD842328FD0F00A53AF4 /* Sources */, 191 | 9CABFD852328FD0F00A53AF4 /* Frameworks */, 192 | 9CABFD862328FD0F00A53AF4 /* Resources */, 193 | ); 194 | buildRules = ( 195 | ); 196 | dependencies = ( 197 | 9CABFD8A2328FD0F00A53AF4 /* PBXTargetDependency */, 198 | ); 199 | name = CodeViewUITests; 200 | productName = CodeViewUITests; 201 | productReference = 9CABFD882328FD0F00A53AF4 /* CodeViewUITests.xctest */; 202 | productType = "com.apple.product-type.bundle.ui-testing"; 203 | }; 204 | /* End PBXNativeTarget section */ 205 | 206 | /* Begin PBXProject section */ 207 | 9CABFD5D2328FD0E00A53AF4 /* Project object */ = { 208 | isa = PBXProject; 209 | attributes = { 210 | LastUpgradeCheck = 1020; 211 | ORGANIZATIONNAME = meb; 212 | TargetAttributes = { 213 | 9CABFD642328FD0E00A53AF4 = { 214 | CreatedOnToolsVersion = 10.2.1; 215 | }; 216 | 9CABFD7C2328FD0F00A53AF4 = { 217 | CreatedOnToolsVersion = 10.2.1; 218 | TestTargetID = 9CABFD642328FD0E00A53AF4; 219 | }; 220 | 9CABFD872328FD0F00A53AF4 = { 221 | CreatedOnToolsVersion = 10.2.1; 222 | TestTargetID = 9CABFD642328FD0E00A53AF4; 223 | }; 224 | }; 225 | }; 226 | buildConfigurationList = 9CABFD602328FD0E00A53AF4 /* Build configuration list for PBXProject "CodeView" */; 227 | compatibilityVersion = "Xcode 9.3"; 228 | developmentRegion = en; 229 | hasScannedForEncodings = 0; 230 | knownRegions = ( 231 | en, 232 | Base, 233 | ); 234 | mainGroup = 9CABFD5C2328FD0E00A53AF4; 235 | productRefGroup = 9CABFD662328FD0E00A53AF4 /* Products */; 236 | projectDirPath = ""; 237 | projectRoot = ""; 238 | targets = ( 239 | 9CABFD642328FD0E00A53AF4 /* CodeView */, 240 | 9CABFD7C2328FD0F00A53AF4 /* CodeViewTests */, 241 | 9CABFD872328FD0F00A53AF4 /* CodeViewUITests */, 242 | ); 243 | }; 244 | /* End PBXProject section */ 245 | 246 | /* Begin PBXResourcesBuildPhase section */ 247 | 9CABFD632328FD0E00A53AF4 /* Resources */ = { 248 | isa = PBXResourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | 9CABFD752328FD0F00A53AF4 /* LaunchScreen.storyboard in Resources */, 252 | 9CABFD722328FD0F00A53AF4 /* Assets.xcassets in Resources */, 253 | 9CABFD702328FD0E00A53AF4 /* Main.storyboard in Resources */, 254 | ); 255 | runOnlyForDeploymentPostprocessing = 0; 256 | }; 257 | 9CABFD7B2328FD0F00A53AF4 /* Resources */ = { 258 | isa = PBXResourcesBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | 9CABFD862328FD0F00A53AF4 /* Resources */ = { 265 | isa = PBXResourcesBuildPhase; 266 | buildActionMask = 2147483647; 267 | files = ( 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | /* End PBXResourcesBuildPhase section */ 272 | 273 | /* Begin PBXSourcesBuildPhase section */ 274 | 9CABFD612328FD0E00A53AF4 /* Sources */ = { 275 | isa = PBXSourcesBuildPhase; 276 | buildActionMask = 2147483647; 277 | files = ( 278 | 9CABFD6D2328FD0E00A53AF4 /* ViewController.m in Sources */, 279 | 9CABFD782328FD0F00A53AF4 /* main.m in Sources */, 280 | 9CABFD6A2328FD0E00A53AF4 /* AppDelegate.m in Sources */, 281 | 9CABFD9D2328FD4400A53AF4 /* CodeView.m in Sources */, 282 | ); 283 | runOnlyForDeploymentPostprocessing = 0; 284 | }; 285 | 9CABFD792328FD0F00A53AF4 /* Sources */ = { 286 | isa = PBXSourcesBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | 9CABFD822328FD0F00A53AF4 /* CodeViewTests.m in Sources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | 9CABFD842328FD0F00A53AF4 /* Sources */ = { 294 | isa = PBXSourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | 9CABFD8D2328FD0F00A53AF4 /* CodeViewUITests.m in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | /* End PBXSourcesBuildPhase section */ 302 | 303 | /* Begin PBXTargetDependency section */ 304 | 9CABFD7F2328FD0F00A53AF4 /* PBXTargetDependency */ = { 305 | isa = PBXTargetDependency; 306 | target = 9CABFD642328FD0E00A53AF4 /* CodeView */; 307 | targetProxy = 9CABFD7E2328FD0F00A53AF4 /* PBXContainerItemProxy */; 308 | }; 309 | 9CABFD8A2328FD0F00A53AF4 /* PBXTargetDependency */ = { 310 | isa = PBXTargetDependency; 311 | target = 9CABFD642328FD0E00A53AF4 /* CodeView */; 312 | targetProxy = 9CABFD892328FD0F00A53AF4 /* PBXContainerItemProxy */; 313 | }; 314 | /* End PBXTargetDependency section */ 315 | 316 | /* Begin PBXVariantGroup section */ 317 | 9CABFD6E2328FD0E00A53AF4 /* Main.storyboard */ = { 318 | isa = PBXVariantGroup; 319 | children = ( 320 | 9CABFD6F2328FD0E00A53AF4 /* Base */, 321 | ); 322 | name = Main.storyboard; 323 | sourceTree = ""; 324 | }; 325 | 9CABFD732328FD0F00A53AF4 /* LaunchScreen.storyboard */ = { 326 | isa = PBXVariantGroup; 327 | children = ( 328 | 9CABFD742328FD0F00A53AF4 /* Base */, 329 | ); 330 | name = LaunchScreen.storyboard; 331 | sourceTree = ""; 332 | }; 333 | /* End PBXVariantGroup section */ 334 | 335 | /* Begin XCBuildConfiguration section */ 336 | 9CABFD8F2328FD0F00A53AF4 /* Debug */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | ALWAYS_SEARCH_USER_PATHS = NO; 340 | CLANG_ANALYZER_NONNULL = YES; 341 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 342 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 343 | CLANG_CXX_LIBRARY = "libc++"; 344 | CLANG_ENABLE_MODULES = YES; 345 | CLANG_ENABLE_OBJC_ARC = YES; 346 | CLANG_ENABLE_OBJC_WEAK = YES; 347 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 348 | CLANG_WARN_BOOL_CONVERSION = YES; 349 | CLANG_WARN_COMMA = YES; 350 | CLANG_WARN_CONSTANT_CONVERSION = YES; 351 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 352 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 353 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 354 | CLANG_WARN_EMPTY_BODY = YES; 355 | CLANG_WARN_ENUM_CONVERSION = YES; 356 | CLANG_WARN_INFINITE_RECURSION = YES; 357 | CLANG_WARN_INT_CONVERSION = YES; 358 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 359 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 360 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 361 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 362 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 363 | CLANG_WARN_STRICT_PROTOTYPES = YES; 364 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 365 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 366 | CLANG_WARN_UNREACHABLE_CODE = YES; 367 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 368 | CODE_SIGN_IDENTITY = "iPhone Developer"; 369 | COPY_PHASE_STRIP = NO; 370 | DEBUG_INFORMATION_FORMAT = dwarf; 371 | ENABLE_STRICT_OBJC_MSGSEND = YES; 372 | ENABLE_TESTABILITY = YES; 373 | GCC_C_LANGUAGE_STANDARD = gnu11; 374 | GCC_DYNAMIC_NO_PIC = NO; 375 | GCC_NO_COMMON_BLOCKS = YES; 376 | GCC_OPTIMIZATION_LEVEL = 0; 377 | GCC_PREPROCESSOR_DEFINITIONS = ( 378 | "DEBUG=1", 379 | "$(inherited)", 380 | ); 381 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 382 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 383 | GCC_WARN_UNDECLARED_SELECTOR = YES; 384 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 385 | GCC_WARN_UNUSED_FUNCTION = YES; 386 | GCC_WARN_UNUSED_VARIABLE = YES; 387 | IPHONEOS_DEPLOYMENT_TARGET = 12.2; 388 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 389 | MTL_FAST_MATH = YES; 390 | ONLY_ACTIVE_ARCH = YES; 391 | SDKROOT = iphoneos; 392 | }; 393 | name = Debug; 394 | }; 395 | 9CABFD902328FD0F00A53AF4 /* Release */ = { 396 | isa = XCBuildConfiguration; 397 | buildSettings = { 398 | ALWAYS_SEARCH_USER_PATHS = NO; 399 | CLANG_ANALYZER_NONNULL = YES; 400 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 401 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 402 | CLANG_CXX_LIBRARY = "libc++"; 403 | CLANG_ENABLE_MODULES = YES; 404 | CLANG_ENABLE_OBJC_ARC = YES; 405 | CLANG_ENABLE_OBJC_WEAK = YES; 406 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 407 | CLANG_WARN_BOOL_CONVERSION = YES; 408 | CLANG_WARN_COMMA = YES; 409 | CLANG_WARN_CONSTANT_CONVERSION = YES; 410 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 411 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 412 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 413 | CLANG_WARN_EMPTY_BODY = YES; 414 | CLANG_WARN_ENUM_CONVERSION = YES; 415 | CLANG_WARN_INFINITE_RECURSION = YES; 416 | CLANG_WARN_INT_CONVERSION = YES; 417 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 418 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 419 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 420 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 421 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 422 | CLANG_WARN_STRICT_PROTOTYPES = YES; 423 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 424 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 425 | CLANG_WARN_UNREACHABLE_CODE = YES; 426 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 427 | CODE_SIGN_IDENTITY = "iPhone Developer"; 428 | COPY_PHASE_STRIP = NO; 429 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 430 | ENABLE_NS_ASSERTIONS = NO; 431 | ENABLE_STRICT_OBJC_MSGSEND = YES; 432 | GCC_C_LANGUAGE_STANDARD = gnu11; 433 | GCC_NO_COMMON_BLOCKS = YES; 434 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 435 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 436 | GCC_WARN_UNDECLARED_SELECTOR = YES; 437 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 438 | GCC_WARN_UNUSED_FUNCTION = YES; 439 | GCC_WARN_UNUSED_VARIABLE = YES; 440 | IPHONEOS_DEPLOYMENT_TARGET = 12.2; 441 | MTL_ENABLE_DEBUG_INFO = NO; 442 | MTL_FAST_MATH = YES; 443 | SDKROOT = iphoneos; 444 | VALIDATE_PRODUCT = YES; 445 | }; 446 | name = Release; 447 | }; 448 | 9CABFD922328FD0F00A53AF4 /* Debug */ = { 449 | isa = XCBuildConfiguration; 450 | buildSettings = { 451 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 452 | CODE_SIGN_STYLE = Automatic; 453 | DEVELOPMENT_TEAM = 2335BFG8W8; 454 | INFOPLIST_FILE = CodeView/Info.plist; 455 | LD_RUNPATH_SEARCH_PATHS = ( 456 | "$(inherited)", 457 | "@executable_path/Frameworks", 458 | ); 459 | PRODUCT_BUNDLE_IDENTIFIER = smartsens.CodeView; 460 | PRODUCT_NAME = "$(TARGET_NAME)"; 461 | TARGETED_DEVICE_FAMILY = "1,2"; 462 | }; 463 | name = Debug; 464 | }; 465 | 9CABFD932328FD0F00A53AF4 /* Release */ = { 466 | isa = XCBuildConfiguration; 467 | buildSettings = { 468 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 469 | CODE_SIGN_STYLE = Automatic; 470 | DEVELOPMENT_TEAM = 2335BFG8W8; 471 | INFOPLIST_FILE = CodeView/Info.plist; 472 | LD_RUNPATH_SEARCH_PATHS = ( 473 | "$(inherited)", 474 | "@executable_path/Frameworks", 475 | ); 476 | PRODUCT_BUNDLE_IDENTIFIER = smartsens.CodeView; 477 | PRODUCT_NAME = "$(TARGET_NAME)"; 478 | TARGETED_DEVICE_FAMILY = "1,2"; 479 | }; 480 | name = Release; 481 | }; 482 | 9CABFD952328FD0F00A53AF4 /* Debug */ = { 483 | isa = XCBuildConfiguration; 484 | buildSettings = { 485 | BUNDLE_LOADER = "$(TEST_HOST)"; 486 | CODE_SIGN_STYLE = Automatic; 487 | DEVELOPMENT_TEAM = 2335BFG8W8; 488 | INFOPLIST_FILE = CodeViewTests/Info.plist; 489 | LD_RUNPATH_SEARCH_PATHS = ( 490 | "$(inherited)", 491 | "@executable_path/Frameworks", 492 | "@loader_path/Frameworks", 493 | ); 494 | PRODUCT_BUNDLE_IDENTIFIER = smartsens.CodeViewTests; 495 | PRODUCT_NAME = "$(TARGET_NAME)"; 496 | TARGETED_DEVICE_FAMILY = "1,2"; 497 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CodeView.app/CodeView"; 498 | }; 499 | name = Debug; 500 | }; 501 | 9CABFD962328FD0F00A53AF4 /* Release */ = { 502 | isa = XCBuildConfiguration; 503 | buildSettings = { 504 | BUNDLE_LOADER = "$(TEST_HOST)"; 505 | CODE_SIGN_STYLE = Automatic; 506 | DEVELOPMENT_TEAM = 2335BFG8W8; 507 | INFOPLIST_FILE = CodeViewTests/Info.plist; 508 | LD_RUNPATH_SEARCH_PATHS = ( 509 | "$(inherited)", 510 | "@executable_path/Frameworks", 511 | "@loader_path/Frameworks", 512 | ); 513 | PRODUCT_BUNDLE_IDENTIFIER = smartsens.CodeViewTests; 514 | PRODUCT_NAME = "$(TARGET_NAME)"; 515 | TARGETED_DEVICE_FAMILY = "1,2"; 516 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CodeView.app/CodeView"; 517 | }; 518 | name = Release; 519 | }; 520 | 9CABFD982328FD0F00A53AF4 /* Debug */ = { 521 | isa = XCBuildConfiguration; 522 | buildSettings = { 523 | CODE_SIGN_STYLE = Automatic; 524 | DEVELOPMENT_TEAM = 2335BFG8W8; 525 | INFOPLIST_FILE = CodeViewUITests/Info.plist; 526 | LD_RUNPATH_SEARCH_PATHS = ( 527 | "$(inherited)", 528 | "@executable_path/Frameworks", 529 | "@loader_path/Frameworks", 530 | ); 531 | PRODUCT_BUNDLE_IDENTIFIER = smartsens.CodeViewUITests; 532 | PRODUCT_NAME = "$(TARGET_NAME)"; 533 | TARGETED_DEVICE_FAMILY = "1,2"; 534 | TEST_TARGET_NAME = CodeView; 535 | }; 536 | name = Debug; 537 | }; 538 | 9CABFD992328FD0F00A53AF4 /* Release */ = { 539 | isa = XCBuildConfiguration; 540 | buildSettings = { 541 | CODE_SIGN_STYLE = Automatic; 542 | DEVELOPMENT_TEAM = 2335BFG8W8; 543 | INFOPLIST_FILE = CodeViewUITests/Info.plist; 544 | LD_RUNPATH_SEARCH_PATHS = ( 545 | "$(inherited)", 546 | "@executable_path/Frameworks", 547 | "@loader_path/Frameworks", 548 | ); 549 | PRODUCT_BUNDLE_IDENTIFIER = smartsens.CodeViewUITests; 550 | PRODUCT_NAME = "$(TARGET_NAME)"; 551 | TARGETED_DEVICE_FAMILY = "1,2"; 552 | TEST_TARGET_NAME = CodeView; 553 | }; 554 | name = Release; 555 | }; 556 | /* End XCBuildConfiguration section */ 557 | 558 | /* Begin XCConfigurationList section */ 559 | 9CABFD602328FD0E00A53AF4 /* Build configuration list for PBXProject "CodeView" */ = { 560 | isa = XCConfigurationList; 561 | buildConfigurations = ( 562 | 9CABFD8F2328FD0F00A53AF4 /* Debug */, 563 | 9CABFD902328FD0F00A53AF4 /* Release */, 564 | ); 565 | defaultConfigurationIsVisible = 0; 566 | defaultConfigurationName = Release; 567 | }; 568 | 9CABFD912328FD0F00A53AF4 /* Build configuration list for PBXNativeTarget "CodeView" */ = { 569 | isa = XCConfigurationList; 570 | buildConfigurations = ( 571 | 9CABFD922328FD0F00A53AF4 /* Debug */, 572 | 9CABFD932328FD0F00A53AF4 /* Release */, 573 | ); 574 | defaultConfigurationIsVisible = 0; 575 | defaultConfigurationName = Release; 576 | }; 577 | 9CABFD942328FD0F00A53AF4 /* Build configuration list for PBXNativeTarget "CodeViewTests" */ = { 578 | isa = XCConfigurationList; 579 | buildConfigurations = ( 580 | 9CABFD952328FD0F00A53AF4 /* Debug */, 581 | 9CABFD962328FD0F00A53AF4 /* Release */, 582 | ); 583 | defaultConfigurationIsVisible = 0; 584 | defaultConfigurationName = Release; 585 | }; 586 | 9CABFD972328FD0F00A53AF4 /* Build configuration list for PBXNativeTarget "CodeViewUITests" */ = { 587 | isa = XCConfigurationList; 588 | buildConfigurations = ( 589 | 9CABFD982328FD0F00A53AF4 /* Debug */, 590 | 9CABFD992328FD0F00A53AF4 /* Release */, 591 | ); 592 | defaultConfigurationIsVisible = 0; 593 | defaultConfigurationName = Release; 594 | }; 595 | /* End XCConfigurationList section */ 596 | }; 597 | rootObject = 9CABFD5D2328FD0E00A53AF4 /* Project object */; 598 | } 599 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView.xcodeproj/project.xcworkspace/xcuserdata/zksz.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamXZP/CodeView/728f2f4e825832da02efa595a86a1d0d2a713225/CodeView_OC_Demo/CodeView/CodeView.xcodeproj/project.xcworkspace/xcuserdata/zksz.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView.xcodeproj/xcuserdata/zksz.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 35 | 36 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView.xcodeproj/xcuserdata/zksz.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CodeView.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CodeView 4 | // 5 | // Created by zksz on 2019/9/11. 6 | // Copyright © 2019 meb. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CodeView 4 | // 5 | // Created by zksz on 2019/9/11. 6 | // Copyright © 2019 meb. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView/Assets.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 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView/Base.lproj/LaunchScreen.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 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView/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 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView/CodeView/CodeView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CodeView.h 3 | // CodeView 4 | // 5 | // Created by meb on 2019/9/11. 6 | // Copyright © 2019 meb. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | typedef NS_ENUM(NSInteger, CodeStyle) { 13 | CodeStyle_line, //下划线格式 14 | CodeStyle_border //带边框格式 15 | }; 16 | typedef void(^SelectCodeBlock)(NSString *); 17 | @interface CodeView : UIView 18 | @property(nonatomic,copy)SelectCodeBlock codeBlock;//验证码回调 19 | - (instancetype)initWithFrame:(CGRect)frame codeNumber:(NSInteger)codeNumber style:(CodeStyle)style labelFont:(CGFloat)labelFont labelTextColor:(UIColor *)labelTextColor mainColor:(UIColor *)mainColor normalColor:(UIColor *)normalColor selectCodeBlock:(SelectCodeBlock)CodeBlock; 20 | - (void)startEdit; 21 | - (void)endEdit; 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView/CodeView/CodeView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CodeView.m 3 | // CodeView 4 | // 5 | // Created by meb on 2019/9/11. 6 | // Copyright © 2019 meb. All rights reserved. 7 | // 8 | 9 | #import "CodeView.h" 10 | 11 | #define margin 12.0 //两个验证码之间的间距 随需求可以更改 12 | 13 | @interface CodeView() 14 | @property(nonatomic,strong)UITextField * textField; 15 | @property(nonatomic,strong)NSMutableArray * shapeArray; //自定义底部线条、边框存放的数组 16 | @property(nonatomic,strong)NSMutableArray * labelArray; //文字存放的数组 17 | @property(nonatomic,strong)NSMutableArray * layerArray; //光标数组 18 | @property(nonatomic,assign)NSInteger codeNumber;//验证码输入个数(4或6个) 19 | @property(nonatomic,assign)CGFloat labelFont;//验证码字体大小 20 | @property(nonatomic,strong)UIColor *labelTextColor;//验证码字体颜色 21 | @property(nonatomic,strong)UIColor *mainColor;//光标颜色和输入验证码的边框、线条颜色 22 | @property(nonatomic,strong)UIColor *normalColor;//未选中的颜色 23 | @property(nonatomic,assign)CodeStyle style;//输入框的风格 24 | @end 25 | @implementation CodeView 26 | - (instancetype)initWithFrame:(CGRect)frame codeNumber:(NSInteger)codeNumber style:(CodeStyle)style labelFont:(CGFloat)labelFont labelTextColor:(UIColor *)labelTextColor mainColor:(UIColor *)mainColor normalColor:(UIColor *)normalColor selectCodeBlock:(SelectCodeBlock)CodeBlock { 27 | self = [super initWithFrame:frame]; 28 | if (self) { 29 | self.codeBlock = CodeBlock; 30 | self.codeNumber = codeNumber; 31 | self.style = style; 32 | self.labelFont = labelFont; 33 | self.labelTextColor = labelTextColor; 34 | self.mainColor = mainColor; 35 | self.normalColor = normalColor; 36 | [self setUpSubview]; 37 | } 38 | return self; 39 | } 40 | 41 | - (void)setUpSubview { 42 | //每一个验证码的宽度 43 | CGFloat width = (CGRectGetWidth(self.bounds) - (self.codeNumber-1)*margin)/self.codeNumber; 44 | [self addSubview:self.textField]; 45 | self.textField.frame = self.bounds; 46 | 47 | for (int i = 0; i < self.codeNumber; i ++) { 48 | UIView *subView = [[UIView alloc] init]; 49 | subView.frame = CGRectMake((width+margin)*i, 0, width, width); 50 | subView.userInteractionEnabled = NO; 51 | subView.layer.cornerRadius = 5 ; 52 | [self addSubview:subView]; 53 | 54 | //底部线条、边框的格式 55 | CALayer *layer = [[CALayer alloc]init]; 56 | if (self.style == CodeStyle_line) { 57 | layer.frame = CGRectMake(4, width-1, width-8, 1); 58 | if (i == 0) { 59 | layer.backgroundColor = self.mainColor.CGColor; 60 | }else{ 61 | layer.backgroundColor = self.normalColor.CGColor; 62 | } 63 | 64 | }else{ 65 | layer.frame = CGRectMake(0, 0, width, width); 66 | layer.borderWidth = 0.5; 67 | layer.cornerRadius = 5; 68 | layer.backgroundColor = UIColor.whiteColor.CGColor; 69 | if (i == 0) { 70 | layer.borderColor = self.mainColor.CGColor; 71 | }else{ 72 | layer.borderColor = self.normalColor.CGColor; 73 | } 74 | } 75 | [subView.layer addSublayer:layer]; 76 | 77 | //验证码文字设置 78 | UILabel *label = [[UILabel alloc]init]; 79 | label.frame = CGRectMake(0, 0, width, width); 80 | label.textAlignment = NSTextAlignmentCenter; 81 | label.textColor = self.labelTextColor; 82 | label.font = [UIFont systemFontOfSize:self.labelFont]; 83 | label.backgroundColor = UIColor.clearColor; 84 | [subView addSubview:label]; 85 | //光标 86 | UIBezierPath *path = [UIBezierPath bezierPathWithRect:CGRectMake(width/2, (width/2)-8, 2,16)]; 87 | CAShapeLayer *line = [CAShapeLayer layer]; 88 | line.path = path.CGPath; 89 | line.fillColor = self.mainColor.CGColor; 90 | [subView.layer addSublayer:line]; 91 | if (i == 0) { 92 | [line addAnimation:[self opacityAnimation] forKey:@"kOpacityAnimation"]; 93 | //高亮颜色 94 | line.hidden = NO; 95 | }else { 96 | line.hidden = YES; 97 | } 98 | [self.shapeArray addObject:line]; 99 | [self.labelArray addObject:label]; 100 | [self.layerArray addObject:layer]; 101 | } 102 | [self startEdit]; 103 | } 104 | 105 | #pragma mark ---- UItextFieldDelegate ---- 106 | 107 | - (void)textchange:(UITextField *)textField { 108 | NSString *verStr = textField.text; 109 | if (verStr.length > self.codeNumber) { 110 | textField.text = [textField.text substringToIndex:self.codeNumber]; 111 | } 112 | //当输入内容等于验证码的长度时候,把输入的验证码回调 113 | if (verStr.length >= self.codeNumber) { 114 | if (self.codeBlock) { 115 | self.codeBlock(textField.text); 116 | } 117 | } 118 | //设置文字的显示和光标的移动 119 | for (int i = 0; i < self.labelArray.count; i ++) { 120 | UILabel *bgLabel = self.labelArray[i]; 121 | if (i < verStr.length) { 122 | bgLabel.text = [verStr substringWithRange:NSMakeRange(i, 1)]; 123 | }else { 124 | bgLabel.text = @""; 125 | } 126 | [self changeOpacityAnimalForShapeLayerWithIndex:i shapeArrayHidden:i == verStr.length ? NO : YES]; 127 | [self changeColorForLayerWithIndex:i shapeArrayHidden:i > verStr.length ? NO : YES]; 128 | } 129 | } 130 | //根据文字所在的位置设置底部layer的颜色 131 | - (void)changeColorForLayerWithIndex:(NSInteger)index shapeArrayHidden:(BOOL)hidden { 132 | CALayer *layer = self.layerArray[index]; 133 | if (hidden) { 134 | if (self.style == CodeStyle_line) { 135 | layer.backgroundColor = self.mainColor.CGColor; 136 | }else{ 137 | layer.borderColor =self.mainColor.CGColor; 138 | } 139 | }else{ 140 | if (self.style == CodeStyle_line) { 141 | layer.backgroundColor = self.normalColor.CGColor; 142 | }else{ 143 | layer.borderColor = self.normalColor.CGColor; 144 | } 145 | } 146 | } 147 | 148 | //根据文字所在的位置改变光标的位置 149 | - (void)changeOpacityAnimalForShapeLayerWithIndex:(NSInteger)index shapeArrayHidden:(BOOL)hidden { 150 | CAShapeLayer *line = self.shapeArray[index]; 151 | if (hidden) { 152 | [line removeAnimationForKey:@"kOpacityAnimation"]; 153 | 154 | }else{ 155 | [line addAnimation:[self opacityAnimation] forKey:@"kOpacityAnimation"]; 156 | } 157 | [UIView animateWithDuration:0.25 animations:^{ 158 | line.hidden = hidden; 159 | }]; 160 | } 161 | //开始编辑 162 | - (void)startEdit{ 163 | [self.textField becomeFirstResponder]; 164 | } 165 | //结束编辑 166 | - (void)endEdit{ 167 | [self.textField resignFirstResponder]; 168 | } 169 | 170 | #pragma mark ---- lazy ---- 171 | //闪动动画 172 | - (CABasicAnimation *)opacityAnimation { 173 | CABasicAnimation *opacityAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; 174 | opacityAnimation.fromValue = @(1.0); 175 | opacityAnimation.toValue = @(0.0); 176 | opacityAnimation.duration = 0.9; 177 | opacityAnimation.repeatCount = HUGE_VALF; 178 | opacityAnimation.removedOnCompletion = YES; 179 | opacityAnimation.fillMode = kCAFillModeForwards; 180 | opacityAnimation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; 181 | return opacityAnimation; 182 | } 183 | - (NSMutableArray *)shapeArray { 184 | if (!_shapeArray) { 185 | _shapeArray = [NSMutableArray array]; 186 | } 187 | return _shapeArray; 188 | } 189 | - (NSMutableArray *)layerArray { 190 | if (!_layerArray) { 191 | _layerArray= [NSMutableArray array]; 192 | } 193 | return _layerArray; 194 | } 195 | - (NSMutableArray *)labelArray { 196 | if (!_labelArray) { 197 | _labelArray = [NSMutableArray array]; 198 | } 199 | return _labelArray; 200 | } 201 | - (UITextField *)textField { 202 | if (!_textField) { 203 | _textField = [UITextField new]; 204 | _textField.tintColor = [UIColor clearColor]; 205 | _textField.backgroundColor = [UIColor clearColor]; 206 | _textField.textColor = [UIColor clearColor]; 207 | _textField.delegate = self; 208 | _textField.keyboardType = UIKeyboardTypeNumberPad; 209 | [_textField addTarget:self action:@selector(textchange:) forControlEvents:UIControlEventEditingChanged]; 210 | if (@available(iOS 12.0, *)) { 211 | //Xcode 10 适配 212 | self.textField.textContentType = UITextContentTypeOneTimeCode; 213 | } 214 | } 215 | return _textField; 216 | } 217 | 218 | @end 219 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CodeView 4 | // 5 | // Created by zksz on 2019/9/11. 6 | // Copyright © 2019 meb. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CodeView 4 | // 5 | // Created by zksz on 2019/9/11. 6 | // Copyright © 2019 meb. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "CodeView/CodeView.h" 11 | #define SCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | CodeView *codeView = [[CodeView alloc]initWithFrame:CGRectMake(50, 160, SCREEN_WIDTH - 100, 50) codeNumber:6 style:CodeStyle_border labelFont:20 labelTextColor:UIColor.blackColor mainColor:UIColor.orangeColor normalColor:UIColor.grayColor selectCodeBlock:^(NSString * code) { 21 | NSLog(@"code === %@",code); 22 | }]; 23 | [self.view addSubview:codeView]; 24 | } 25 | 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CodeView 4 | // 5 | // Created by zksz on 2019/9/11. 6 | // Copyright © 2019 meb. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeViewTests/CodeViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CodeViewTests.m 3 | // CodeViewTests 4 | // 5 | // Created by zksz on 2019/9/11. 6 | // Copyright © 2019 meb. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CodeViewTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation CodeViewTests 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | } 20 | 21 | - (void)tearDown { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | - (void)testExample { 26 | // This is an example of a functional test case. 27 | // Use XCTAssert and related functions to verify your tests produce the correct results. 28 | } 29 | 30 | - (void)testPerformanceExample { 31 | // This is an example of a performance test case. 32 | [self measureBlock:^{ 33 | // Put the code you want to measure the time of here. 34 | }]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeViewTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeViewUITests/CodeViewUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CodeViewUITests.m 3 | // CodeViewUITests 4 | // 5 | // Created by zksz on 2019/9/11. 6 | // Copyright © 2019 meb. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CodeViewUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation CodeViewUITests 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | 20 | // In UI tests it is usually best to stop immediately when a failure occurs. 21 | self.continueAfterFailure = NO; 22 | 23 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 24 | [[[XCUIApplication alloc] init] launch]; 25 | 26 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 27 | } 28 | 29 | - (void)tearDown { 30 | // Put teardown code here. This method is called after the invocation of each test method in the class. 31 | } 32 | 33 | - (void)testExample { 34 | // Use recording to get started writing UI tests. 35 | // Use XCTAssert and related functions to verify your tests produce the correct results. 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /CodeView_OC_Demo/CodeView/CodeViewUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /CodeView_Swift_Demo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamXZP/CodeView/728f2f4e825832da02efa595a86a1d0d2a713225/CodeView_Swift_Demo/.DS_Store -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9CAF3BD0231CBB390030BF6F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CAF3BCF231CBB390030BF6F /* AppDelegate.swift */; }; 11 | 9CAF3BD2231CBB390030BF6F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CAF3BD1231CBB390030BF6F /* ViewController.swift */; }; 12 | 9CAF3BD5231CBB390030BF6F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9CAF3BD3231CBB390030BF6F /* Main.storyboard */; }; 13 | 9CAF3BD7231CBB3A0030BF6F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9CAF3BD6231CBB3A0030BF6F /* Assets.xcassets */; }; 14 | 9CAF3BDA231CBB3A0030BF6F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9CAF3BD8231CBB3A0030BF6F /* LaunchScreen.storyboard */; }; 15 | 9CAF3BE5231CBB3A0030BF6F /* CodeViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CAF3BE4231CBB3A0030BF6F /* CodeViewTests.swift */; }; 16 | 9CAF3BF0231CBB3A0030BF6F /* CodeViewUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CAF3BEF231CBB3A0030BF6F /* CodeViewUITests.swift */; }; 17 | 9CAF3BFF231CBB870030BF6F /* CodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CAF3BFE231CBB870030BF6F /* CodeView.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 9CAF3BE1231CBB3A0030BF6F /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 9CAF3BC4231CBB390030BF6F /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 9CAF3BCB231CBB390030BF6F; 26 | remoteInfo = CodeView; 27 | }; 28 | 9CAF3BEC231CBB3A0030BF6F /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 9CAF3BC4231CBB390030BF6F /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = 9CAF3BCB231CBB390030BF6F; 33 | remoteInfo = CodeView; 34 | }; 35 | /* End PBXContainerItemProxy section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | 9CAF3BCC231CBB390030BF6F /* CodeView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CodeView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 9CAF3BCF231CBB390030BF6F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 40 | 9CAF3BD1231CBB390030BF6F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 41 | 9CAF3BD4231CBB390030BF6F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 9CAF3BD6231CBB3A0030BF6F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 9CAF3BD9231CBB3A0030BF6F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 9CAF3BDB231CBB3A0030BF6F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | 9CAF3BE0231CBB3A0030BF6F /* CodeViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CodeViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 9CAF3BE4231CBB3A0030BF6F /* CodeViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeViewTests.swift; sourceTree = ""; }; 47 | 9CAF3BE6231CBB3A0030BF6F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | 9CAF3BEB231CBB3A0030BF6F /* CodeViewUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CodeViewUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 9CAF3BEF231CBB3A0030BF6F /* CodeViewUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeViewUITests.swift; sourceTree = ""; }; 50 | 9CAF3BF1231CBB3A0030BF6F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 9CAF3BFE231CBB870030BF6F /* CodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeView.swift; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | 9CAF3BC9231CBB390030BF6F /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | 9CAF3BDD231CBB3A0030BF6F /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | 9CAF3BE8231CBB3A0030BF6F /* Frameworks */ = { 70 | isa = PBXFrameworksBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | /* End PBXFrameworksBuildPhase section */ 77 | 78 | /* Begin PBXGroup section */ 79 | 9CAF3BC3231CBB390030BF6F = { 80 | isa = PBXGroup; 81 | children = ( 82 | 9CAF3BCE231CBB390030BF6F /* CodeView */, 83 | 9CAF3BE3231CBB3A0030BF6F /* CodeViewTests */, 84 | 9CAF3BEE231CBB3A0030BF6F /* CodeViewUITests */, 85 | 9CAF3BCD231CBB390030BF6F /* Products */, 86 | ); 87 | sourceTree = ""; 88 | }; 89 | 9CAF3BCD231CBB390030BF6F /* Products */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 9CAF3BCC231CBB390030BF6F /* CodeView.app */, 93 | 9CAF3BE0231CBB3A0030BF6F /* CodeViewTests.xctest */, 94 | 9CAF3BEB231CBB3A0030BF6F /* CodeViewUITests.xctest */, 95 | ); 96 | name = Products; 97 | sourceTree = ""; 98 | }; 99 | 9CAF3BCE231CBB390030BF6F /* CodeView */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 9CAF3BFD231CBB6B0030BF6F /* CodeView */, 103 | 9CAF3BCF231CBB390030BF6F /* AppDelegate.swift */, 104 | 9CAF3BD1231CBB390030BF6F /* ViewController.swift */, 105 | 9CAF3BD3231CBB390030BF6F /* Main.storyboard */, 106 | 9CAF3BD6231CBB3A0030BF6F /* Assets.xcassets */, 107 | 9CAF3BD8231CBB3A0030BF6F /* LaunchScreen.storyboard */, 108 | 9CAF3BDB231CBB3A0030BF6F /* Info.plist */, 109 | ); 110 | path = CodeView; 111 | sourceTree = ""; 112 | }; 113 | 9CAF3BE3231CBB3A0030BF6F /* CodeViewTests */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 9CAF3BE4231CBB3A0030BF6F /* CodeViewTests.swift */, 117 | 9CAF3BE6231CBB3A0030BF6F /* Info.plist */, 118 | ); 119 | path = CodeViewTests; 120 | sourceTree = ""; 121 | }; 122 | 9CAF3BEE231CBB3A0030BF6F /* CodeViewUITests */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 9CAF3BEF231CBB3A0030BF6F /* CodeViewUITests.swift */, 126 | 9CAF3BF1231CBB3A0030BF6F /* Info.plist */, 127 | ); 128 | path = CodeViewUITests; 129 | sourceTree = ""; 130 | }; 131 | 9CAF3BFD231CBB6B0030BF6F /* CodeView */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 9CAF3BFE231CBB870030BF6F /* CodeView.swift */, 135 | ); 136 | path = CodeView; 137 | sourceTree = ""; 138 | }; 139 | /* End PBXGroup section */ 140 | 141 | /* Begin PBXNativeTarget section */ 142 | 9CAF3BCB231CBB390030BF6F /* CodeView */ = { 143 | isa = PBXNativeTarget; 144 | buildConfigurationList = 9CAF3BF4231CBB3A0030BF6F /* Build configuration list for PBXNativeTarget "CodeView" */; 145 | buildPhases = ( 146 | 9CAF3BC8231CBB390030BF6F /* Sources */, 147 | 9CAF3BC9231CBB390030BF6F /* Frameworks */, 148 | 9CAF3BCA231CBB390030BF6F /* Resources */, 149 | ); 150 | buildRules = ( 151 | ); 152 | dependencies = ( 153 | ); 154 | name = CodeView; 155 | productName = CodeView; 156 | productReference = 9CAF3BCC231CBB390030BF6F /* CodeView.app */; 157 | productType = "com.apple.product-type.application"; 158 | }; 159 | 9CAF3BDF231CBB3A0030BF6F /* CodeViewTests */ = { 160 | isa = PBXNativeTarget; 161 | buildConfigurationList = 9CAF3BF7231CBB3A0030BF6F /* Build configuration list for PBXNativeTarget "CodeViewTests" */; 162 | buildPhases = ( 163 | 9CAF3BDC231CBB3A0030BF6F /* Sources */, 164 | 9CAF3BDD231CBB3A0030BF6F /* Frameworks */, 165 | 9CAF3BDE231CBB3A0030BF6F /* Resources */, 166 | ); 167 | buildRules = ( 168 | ); 169 | dependencies = ( 170 | 9CAF3BE2231CBB3A0030BF6F /* PBXTargetDependency */, 171 | ); 172 | name = CodeViewTests; 173 | productName = CodeViewTests; 174 | productReference = 9CAF3BE0231CBB3A0030BF6F /* CodeViewTests.xctest */; 175 | productType = "com.apple.product-type.bundle.unit-test"; 176 | }; 177 | 9CAF3BEA231CBB3A0030BF6F /* CodeViewUITests */ = { 178 | isa = PBXNativeTarget; 179 | buildConfigurationList = 9CAF3BFA231CBB3A0030BF6F /* Build configuration list for PBXNativeTarget "CodeViewUITests" */; 180 | buildPhases = ( 181 | 9CAF3BE7231CBB3A0030BF6F /* Sources */, 182 | 9CAF3BE8231CBB3A0030BF6F /* Frameworks */, 183 | 9CAF3BE9231CBB3A0030BF6F /* Resources */, 184 | ); 185 | buildRules = ( 186 | ); 187 | dependencies = ( 188 | 9CAF3BED231CBB3A0030BF6F /* PBXTargetDependency */, 189 | ); 190 | name = CodeViewUITests; 191 | productName = CodeViewUITests; 192 | productReference = 9CAF3BEB231CBB3A0030BF6F /* CodeViewUITests.xctest */; 193 | productType = "com.apple.product-type.bundle.ui-testing"; 194 | }; 195 | /* End PBXNativeTarget section */ 196 | 197 | /* Begin PBXProject section */ 198 | 9CAF3BC4231CBB390030BF6F /* Project object */ = { 199 | isa = PBXProject; 200 | attributes = { 201 | LastSwiftUpdateCheck = 1020; 202 | LastUpgradeCheck = 1020; 203 | ORGANIZATIONNAME = zksz; 204 | TargetAttributes = { 205 | 9CAF3BCB231CBB390030BF6F = { 206 | CreatedOnToolsVersion = 10.2.1; 207 | }; 208 | 9CAF3BDF231CBB3A0030BF6F = { 209 | CreatedOnToolsVersion = 10.2.1; 210 | TestTargetID = 9CAF3BCB231CBB390030BF6F; 211 | }; 212 | 9CAF3BEA231CBB3A0030BF6F = { 213 | CreatedOnToolsVersion = 10.2.1; 214 | TestTargetID = 9CAF3BCB231CBB390030BF6F; 215 | }; 216 | }; 217 | }; 218 | buildConfigurationList = 9CAF3BC7231CBB390030BF6F /* Build configuration list for PBXProject "CodeView" */; 219 | compatibilityVersion = "Xcode 9.3"; 220 | developmentRegion = en; 221 | hasScannedForEncodings = 0; 222 | knownRegions = ( 223 | en, 224 | Base, 225 | ); 226 | mainGroup = 9CAF3BC3231CBB390030BF6F; 227 | productRefGroup = 9CAF3BCD231CBB390030BF6F /* Products */; 228 | projectDirPath = ""; 229 | projectRoot = ""; 230 | targets = ( 231 | 9CAF3BCB231CBB390030BF6F /* CodeView */, 232 | 9CAF3BDF231CBB3A0030BF6F /* CodeViewTests */, 233 | 9CAF3BEA231CBB3A0030BF6F /* CodeViewUITests */, 234 | ); 235 | }; 236 | /* End PBXProject section */ 237 | 238 | /* Begin PBXResourcesBuildPhase section */ 239 | 9CAF3BCA231CBB390030BF6F /* Resources */ = { 240 | isa = PBXResourcesBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | 9CAF3BDA231CBB3A0030BF6F /* LaunchScreen.storyboard in Resources */, 244 | 9CAF3BD7231CBB3A0030BF6F /* Assets.xcassets in Resources */, 245 | 9CAF3BD5231CBB390030BF6F /* Main.storyboard in Resources */, 246 | ); 247 | runOnlyForDeploymentPostprocessing = 0; 248 | }; 249 | 9CAF3BDE231CBB3A0030BF6F /* Resources */ = { 250 | isa = PBXResourcesBuildPhase; 251 | buildActionMask = 2147483647; 252 | files = ( 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | }; 256 | 9CAF3BE9231CBB3A0030BF6F /* Resources */ = { 257 | isa = PBXResourcesBuildPhase; 258 | buildActionMask = 2147483647; 259 | files = ( 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | }; 263 | /* End PBXResourcesBuildPhase section */ 264 | 265 | /* Begin PBXSourcesBuildPhase section */ 266 | 9CAF3BC8231CBB390030BF6F /* Sources */ = { 267 | isa = PBXSourcesBuildPhase; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | 9CAF3BFF231CBB870030BF6F /* CodeView.swift in Sources */, 271 | 9CAF3BD2231CBB390030BF6F /* ViewController.swift in Sources */, 272 | 9CAF3BD0231CBB390030BF6F /* AppDelegate.swift in Sources */, 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | }; 276 | 9CAF3BDC231CBB3A0030BF6F /* Sources */ = { 277 | isa = PBXSourcesBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | 9CAF3BE5231CBB3A0030BF6F /* CodeViewTests.swift in Sources */, 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | }; 284 | 9CAF3BE7231CBB3A0030BF6F /* Sources */ = { 285 | isa = PBXSourcesBuildPhase; 286 | buildActionMask = 2147483647; 287 | files = ( 288 | 9CAF3BF0231CBB3A0030BF6F /* CodeViewUITests.swift in Sources */, 289 | ); 290 | runOnlyForDeploymentPostprocessing = 0; 291 | }; 292 | /* End PBXSourcesBuildPhase section */ 293 | 294 | /* Begin PBXTargetDependency section */ 295 | 9CAF3BE2231CBB3A0030BF6F /* PBXTargetDependency */ = { 296 | isa = PBXTargetDependency; 297 | target = 9CAF3BCB231CBB390030BF6F /* CodeView */; 298 | targetProxy = 9CAF3BE1231CBB3A0030BF6F /* PBXContainerItemProxy */; 299 | }; 300 | 9CAF3BED231CBB3A0030BF6F /* PBXTargetDependency */ = { 301 | isa = PBXTargetDependency; 302 | target = 9CAF3BCB231CBB390030BF6F /* CodeView */; 303 | targetProxy = 9CAF3BEC231CBB3A0030BF6F /* PBXContainerItemProxy */; 304 | }; 305 | /* End PBXTargetDependency section */ 306 | 307 | /* Begin PBXVariantGroup section */ 308 | 9CAF3BD3231CBB390030BF6F /* Main.storyboard */ = { 309 | isa = PBXVariantGroup; 310 | children = ( 311 | 9CAF3BD4231CBB390030BF6F /* Base */, 312 | ); 313 | name = Main.storyboard; 314 | sourceTree = ""; 315 | }; 316 | 9CAF3BD8231CBB3A0030BF6F /* LaunchScreen.storyboard */ = { 317 | isa = PBXVariantGroup; 318 | children = ( 319 | 9CAF3BD9231CBB3A0030BF6F /* Base */, 320 | ); 321 | name = LaunchScreen.storyboard; 322 | sourceTree = ""; 323 | }; 324 | /* End PBXVariantGroup section */ 325 | 326 | /* Begin XCBuildConfiguration section */ 327 | 9CAF3BF2231CBB3A0030BF6F /* Debug */ = { 328 | isa = XCBuildConfiguration; 329 | buildSettings = { 330 | ALWAYS_SEARCH_USER_PATHS = NO; 331 | CLANG_ANALYZER_NONNULL = YES; 332 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 333 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 334 | CLANG_CXX_LIBRARY = "libc++"; 335 | CLANG_ENABLE_MODULES = YES; 336 | CLANG_ENABLE_OBJC_ARC = YES; 337 | CLANG_ENABLE_OBJC_WEAK = YES; 338 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 339 | CLANG_WARN_BOOL_CONVERSION = YES; 340 | CLANG_WARN_COMMA = YES; 341 | CLANG_WARN_CONSTANT_CONVERSION = YES; 342 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 343 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 344 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 345 | CLANG_WARN_EMPTY_BODY = YES; 346 | CLANG_WARN_ENUM_CONVERSION = YES; 347 | CLANG_WARN_INFINITE_RECURSION = YES; 348 | CLANG_WARN_INT_CONVERSION = YES; 349 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 350 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 351 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 352 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 353 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 354 | CLANG_WARN_STRICT_PROTOTYPES = YES; 355 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 356 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 357 | CLANG_WARN_UNREACHABLE_CODE = YES; 358 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 359 | CODE_SIGN_IDENTITY = "iPhone Developer"; 360 | COPY_PHASE_STRIP = NO; 361 | DEBUG_INFORMATION_FORMAT = dwarf; 362 | ENABLE_STRICT_OBJC_MSGSEND = YES; 363 | ENABLE_TESTABILITY = YES; 364 | GCC_C_LANGUAGE_STANDARD = gnu11; 365 | GCC_DYNAMIC_NO_PIC = NO; 366 | GCC_NO_COMMON_BLOCKS = YES; 367 | GCC_OPTIMIZATION_LEVEL = 0; 368 | GCC_PREPROCESSOR_DEFINITIONS = ( 369 | "DEBUG=1", 370 | "$(inherited)", 371 | ); 372 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 373 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 374 | GCC_WARN_UNDECLARED_SELECTOR = YES; 375 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 376 | GCC_WARN_UNUSED_FUNCTION = YES; 377 | GCC_WARN_UNUSED_VARIABLE = YES; 378 | IPHONEOS_DEPLOYMENT_TARGET = 12.2; 379 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 380 | MTL_FAST_MATH = YES; 381 | ONLY_ACTIVE_ARCH = YES; 382 | SDKROOT = iphoneos; 383 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 384 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 385 | }; 386 | name = Debug; 387 | }; 388 | 9CAF3BF3231CBB3A0030BF6F /* Release */ = { 389 | isa = XCBuildConfiguration; 390 | buildSettings = { 391 | ALWAYS_SEARCH_USER_PATHS = NO; 392 | CLANG_ANALYZER_NONNULL = YES; 393 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 394 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 395 | CLANG_CXX_LIBRARY = "libc++"; 396 | CLANG_ENABLE_MODULES = YES; 397 | CLANG_ENABLE_OBJC_ARC = YES; 398 | CLANG_ENABLE_OBJC_WEAK = YES; 399 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 400 | CLANG_WARN_BOOL_CONVERSION = YES; 401 | CLANG_WARN_COMMA = YES; 402 | CLANG_WARN_CONSTANT_CONVERSION = YES; 403 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 404 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 405 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 406 | CLANG_WARN_EMPTY_BODY = YES; 407 | CLANG_WARN_ENUM_CONVERSION = YES; 408 | CLANG_WARN_INFINITE_RECURSION = YES; 409 | CLANG_WARN_INT_CONVERSION = YES; 410 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 412 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 413 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 414 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 415 | CLANG_WARN_STRICT_PROTOTYPES = YES; 416 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 417 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 418 | CLANG_WARN_UNREACHABLE_CODE = YES; 419 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 420 | CODE_SIGN_IDENTITY = "iPhone Developer"; 421 | COPY_PHASE_STRIP = NO; 422 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 423 | ENABLE_NS_ASSERTIONS = NO; 424 | ENABLE_STRICT_OBJC_MSGSEND = YES; 425 | GCC_C_LANGUAGE_STANDARD = gnu11; 426 | GCC_NO_COMMON_BLOCKS = YES; 427 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 428 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 429 | GCC_WARN_UNDECLARED_SELECTOR = YES; 430 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 431 | GCC_WARN_UNUSED_FUNCTION = YES; 432 | GCC_WARN_UNUSED_VARIABLE = YES; 433 | IPHONEOS_DEPLOYMENT_TARGET = 12.2; 434 | MTL_ENABLE_DEBUG_INFO = NO; 435 | MTL_FAST_MATH = YES; 436 | SDKROOT = iphoneos; 437 | SWIFT_COMPILATION_MODE = wholemodule; 438 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 439 | VALIDATE_PRODUCT = YES; 440 | }; 441 | name = Release; 442 | }; 443 | 9CAF3BF5231CBB3A0030BF6F /* Debug */ = { 444 | isa = XCBuildConfiguration; 445 | buildSettings = { 446 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 447 | CODE_SIGN_STYLE = Automatic; 448 | DEVELOPMENT_TEAM = 2335BFG8W8; 449 | INFOPLIST_FILE = CodeView/Info.plist; 450 | LD_RUNPATH_SEARCH_PATHS = ( 451 | "$(inherited)", 452 | "@executable_path/Frameworks", 453 | ); 454 | PRODUCT_BUNDLE_IDENTIFIER = moerben.CodeView; 455 | PRODUCT_NAME = "$(TARGET_NAME)"; 456 | SWIFT_VERSION = 5.0; 457 | TARGETED_DEVICE_FAMILY = "1,2"; 458 | }; 459 | name = Debug; 460 | }; 461 | 9CAF3BF6231CBB3A0030BF6F /* Release */ = { 462 | isa = XCBuildConfiguration; 463 | buildSettings = { 464 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 465 | CODE_SIGN_STYLE = Automatic; 466 | DEVELOPMENT_TEAM = 2335BFG8W8; 467 | INFOPLIST_FILE = CodeView/Info.plist; 468 | LD_RUNPATH_SEARCH_PATHS = ( 469 | "$(inherited)", 470 | "@executable_path/Frameworks", 471 | ); 472 | PRODUCT_BUNDLE_IDENTIFIER = moerben.CodeView; 473 | PRODUCT_NAME = "$(TARGET_NAME)"; 474 | SWIFT_VERSION = 5.0; 475 | TARGETED_DEVICE_FAMILY = "1,2"; 476 | }; 477 | name = Release; 478 | }; 479 | 9CAF3BF8231CBB3A0030BF6F /* Debug */ = { 480 | isa = XCBuildConfiguration; 481 | buildSettings = { 482 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 483 | BUNDLE_LOADER = "$(TEST_HOST)"; 484 | CODE_SIGN_STYLE = Automatic; 485 | DEVELOPMENT_TEAM = 2335BFG8W8; 486 | INFOPLIST_FILE = CodeViewTests/Info.plist; 487 | LD_RUNPATH_SEARCH_PATHS = ( 488 | "$(inherited)", 489 | "@executable_path/Frameworks", 490 | "@loader_path/Frameworks", 491 | ); 492 | PRODUCT_BUNDLE_IDENTIFIER = smartsens.CodeViewTests; 493 | PRODUCT_NAME = "$(TARGET_NAME)"; 494 | SWIFT_VERSION = 5.0; 495 | TARGETED_DEVICE_FAMILY = "1,2"; 496 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CodeView.app/CodeView"; 497 | }; 498 | name = Debug; 499 | }; 500 | 9CAF3BF9231CBB3A0030BF6F /* Release */ = { 501 | isa = XCBuildConfiguration; 502 | buildSettings = { 503 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 504 | BUNDLE_LOADER = "$(TEST_HOST)"; 505 | CODE_SIGN_STYLE = Automatic; 506 | DEVELOPMENT_TEAM = 2335BFG8W8; 507 | INFOPLIST_FILE = CodeViewTests/Info.plist; 508 | LD_RUNPATH_SEARCH_PATHS = ( 509 | "$(inherited)", 510 | "@executable_path/Frameworks", 511 | "@loader_path/Frameworks", 512 | ); 513 | PRODUCT_BUNDLE_IDENTIFIER = smartsens.CodeViewTests; 514 | PRODUCT_NAME = "$(TARGET_NAME)"; 515 | SWIFT_VERSION = 5.0; 516 | TARGETED_DEVICE_FAMILY = "1,2"; 517 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CodeView.app/CodeView"; 518 | }; 519 | name = Release; 520 | }; 521 | 9CAF3BFB231CBB3A0030BF6F /* Debug */ = { 522 | isa = XCBuildConfiguration; 523 | buildSettings = { 524 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 525 | CODE_SIGN_STYLE = Automatic; 526 | DEVELOPMENT_TEAM = 2335BFG8W8; 527 | INFOPLIST_FILE = CodeViewUITests/Info.plist; 528 | LD_RUNPATH_SEARCH_PATHS = ( 529 | "$(inherited)", 530 | "@executable_path/Frameworks", 531 | "@loader_path/Frameworks", 532 | ); 533 | PRODUCT_BUNDLE_IDENTIFIER = smartsens.CodeViewUITests; 534 | PRODUCT_NAME = "$(TARGET_NAME)"; 535 | SWIFT_VERSION = 5.0; 536 | TARGETED_DEVICE_FAMILY = "1,2"; 537 | TEST_TARGET_NAME = CodeView; 538 | }; 539 | name = Debug; 540 | }; 541 | 9CAF3BFC231CBB3A0030BF6F /* Release */ = { 542 | isa = XCBuildConfiguration; 543 | buildSettings = { 544 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 545 | CODE_SIGN_STYLE = Automatic; 546 | DEVELOPMENT_TEAM = 2335BFG8W8; 547 | INFOPLIST_FILE = CodeViewUITests/Info.plist; 548 | LD_RUNPATH_SEARCH_PATHS = ( 549 | "$(inherited)", 550 | "@executable_path/Frameworks", 551 | "@loader_path/Frameworks", 552 | ); 553 | PRODUCT_BUNDLE_IDENTIFIER = smartsens.CodeViewUITests; 554 | PRODUCT_NAME = "$(TARGET_NAME)"; 555 | SWIFT_VERSION = 5.0; 556 | TARGETED_DEVICE_FAMILY = "1,2"; 557 | TEST_TARGET_NAME = CodeView; 558 | }; 559 | name = Release; 560 | }; 561 | /* End XCBuildConfiguration section */ 562 | 563 | /* Begin XCConfigurationList section */ 564 | 9CAF3BC7231CBB390030BF6F /* Build configuration list for PBXProject "CodeView" */ = { 565 | isa = XCConfigurationList; 566 | buildConfigurations = ( 567 | 9CAF3BF2231CBB3A0030BF6F /* Debug */, 568 | 9CAF3BF3231CBB3A0030BF6F /* Release */, 569 | ); 570 | defaultConfigurationIsVisible = 0; 571 | defaultConfigurationName = Release; 572 | }; 573 | 9CAF3BF4231CBB3A0030BF6F /* Build configuration list for PBXNativeTarget "CodeView" */ = { 574 | isa = XCConfigurationList; 575 | buildConfigurations = ( 576 | 9CAF3BF5231CBB3A0030BF6F /* Debug */, 577 | 9CAF3BF6231CBB3A0030BF6F /* Release */, 578 | ); 579 | defaultConfigurationIsVisible = 0; 580 | defaultConfigurationName = Release; 581 | }; 582 | 9CAF3BF7231CBB3A0030BF6F /* Build configuration list for PBXNativeTarget "CodeViewTests" */ = { 583 | isa = XCConfigurationList; 584 | buildConfigurations = ( 585 | 9CAF3BF8231CBB3A0030BF6F /* Debug */, 586 | 9CAF3BF9231CBB3A0030BF6F /* Release */, 587 | ); 588 | defaultConfigurationIsVisible = 0; 589 | defaultConfigurationName = Release; 590 | }; 591 | 9CAF3BFA231CBB3A0030BF6F /* Build configuration list for PBXNativeTarget "CodeViewUITests" */ = { 592 | isa = XCConfigurationList; 593 | buildConfigurations = ( 594 | 9CAF3BFB231CBB3A0030BF6F /* Debug */, 595 | 9CAF3BFC231CBB3A0030BF6F /* Release */, 596 | ); 597 | defaultConfigurationIsVisible = 0; 598 | defaultConfigurationName = Release; 599 | }; 600 | /* End XCConfigurationList section */ 601 | }; 602 | rootObject = 9CAF3BC4231CBB390030BF6F /* Project object */; 603 | } 604 | -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeView.xcodeproj/project.xcworkspace/xcuserdata/zksz.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamXZP/CodeView/728f2f4e825832da02efa595a86a1d0d2a713225/CodeView_Swift_Demo/CodeView.xcodeproj/project.xcworkspace/xcuserdata/zksz.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeView.xcodeproj/xcuserdata/zksz.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeView.xcodeproj/xcuserdata/zksz.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CodeView.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeView/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CodeView 4 | // 5 | // Created by zksz on 2019/9/2. 6 | // Copyright © 2019 zksz. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // 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. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeView/Assets.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 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeView/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeView/Base.lproj/LaunchScreen.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 | -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeView/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 | -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeView/CodeView/CodeView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CodeView.swift 3 | // CodeView 4 | // 5 | // Created by zksz on 2019/9/2. 6 | // Copyright © 2019 zksz. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | let margin:CGFloat = 12 //两个验证码之间的间距 随需求可以更改 12 | 13 | enum CodeStyle { 14 | case CodeStyle_line //下划线格式 15 | case CodeStyle_border //带边框格式 16 | } 17 | 18 | class CodeView: UIView { 19 | 20 | fileprivate var shapeArray:[CAShapeLayer] = Array() //自定义底部线条、边框存放的数组 21 | fileprivate var labelArray:[UILabel] = Array() //文字存放的数组 22 | fileprivate var layerArray:[CALayer] = Array() 23 | public var codeNumber:Int = 0 //验证码位数 24 | public var mainColor:UIColor? //光标颜色和输入验证码的边框、线条颜色 25 | public var normalColor:UIColor? //未选中的颜色 26 | public var labelTextColor:UIColor? //验证码文字的验证 27 | public var style:CodeStyle? //输入框的风格 28 | public var codeBlock: ((String) -> Void)? //验证码回调 29 | public lazy var textField: UITextField = { 30 | let view = UITextField.init() 31 | view.tintColor = UIColor.clear 32 | view.backgroundColor = UIColor.clear 33 | view.textColor = UIColor.clear 34 | view.keyboardType = .numberPad 35 | if #available(iOS 12.0, *) { 36 | view.textContentType = .oneTimeCode //验证码自动填充 37 | } 38 | view.addTarget(self, action: #selector(textChage( _:)), for: .editingChanged) 39 | return view 40 | }() 41 | 42 | override init(frame: CGRect) { 43 | super.init(frame: frame) 44 | } 45 | 46 | required init?(coder aDecoder: NSCoder) { 47 | fatalError("init(coder:) has not been implemented") 48 | } 49 | 50 | init(frame:CGRect,codeNumber:Int = 6,style:CodeStyle,labelTextColor:UIColor = UIColor.black, mainColor:UIColor = UIColor.orange,normalColor:UIColor = UIColor.gray) { 51 | super.init(frame: frame) 52 | self.codeNumber = codeNumber 53 | self.labelTextColor = labelTextColor 54 | self.mainColor = mainColor 55 | self.normalColor = normalColor 56 | self.style = style 57 | setUpSubview() 58 | } 59 | 60 | fileprivate func setUpSubview() { 61 | //每一个验证码的宽度 62 | let width = (self.bounds.width - CGFloat(codeNumber-1)*margin)/CGFloat(codeNumber) 63 | self.addSubview(textField) 64 | textField.frame = self.bounds 65 | for index in 0.. codeNumber { 129 | let substring = textField.text?.prefix(codeNumber) //控制输入文字的长度 130 | textField.text = String(substring ?? "") 131 | verStr = textField.text ?? "" 132 | } 133 | //当输入内容等于验证码的长度时候,把输入的验证码回调 134 | if verStr.count >= codeNumber { 135 | if (self.codeBlock != nil) { 136 | self.codeBlock?(textField.text ?? "") 137 | } 138 | } 139 | //设置文字的显示和光标的移动 140 | for index in 0.. verStr.count ? false : true) 151 | } 152 | } 153 | 154 | //根据文字所在的位置设置底部layer的颜色 155 | fileprivate func changeColorForLayerWithIndex(index:NSInteger, hidden:Bool) { 156 | let layer = layerArray[index]; 157 | if (hidden) { 158 | if style == .CodeStyle_line { 159 | layer.backgroundColor = mainColor?.cgColor; 160 | }else{ 161 | layer.borderColor = mainColor?.cgColor; 162 | } 163 | 164 | }else{ 165 | if style == .CodeStyle_line { 166 | layer.backgroundColor = normalColor?.cgColor; 167 | }else{ 168 | layer.borderColor = normalColor?.cgColor; 169 | } 170 | } 171 | } 172 | //根据文字所在的位置改变光标的位置 173 | fileprivate func changeOpacityAnimalForShapeLayerWithIndex(index:Int, hidden:Bool) { 174 | let line = shapeArray[index] 175 | if hidden { 176 | line.removeAnimation(forKey: "kOpacityAnimation") 177 | } 178 | else{ 179 | line.add(opacityAnimation(), forKey: "kOpacityAnimation") 180 | } 181 | UIView.animate(withDuration: 0.25) { 182 | line.isHidden = hidden 183 | } 184 | } 185 | //开启键盘 186 | public func startEdit() { 187 | textField.becomeFirstResponder() 188 | } 189 | //关闭键盘 190 | public func endEdit() { 191 | textField.resignFirstResponder() 192 | } 193 | 194 | //模仿光标 闪动效果 195 | fileprivate func opacityAnimation() -> CABasicAnimation { 196 | let animation = CABasicAnimation.init(keyPath: "opacity") 197 | animation.fromValue = 1.0 198 | animation.toValue = 0.0 199 | animation.duration = 0.9 200 | animation.repeatCount = HUGE 201 | animation.isRemovedOnCompletion = true 202 | animation.fillMode = CAMediaTimingFillMode.forwards 203 | animation.timingFunction = CAMediaTimingFunction.init(name: CAMediaTimingFunctionName.easeIn) 204 | return animation 205 | } 206 | } 207 | 208 | -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeView/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // CodeView 4 | // 5 | // Created by zksz on 2019/9/2. 6 | // Copyright © 2019 zksz. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | let SCREEN_WIDTH = UIScreen.main.bounds.size.width 11 | let SCREEN_HEIGHT = UIScreen.main.bounds.size.height 12 | class ViewController: UIViewController { 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | // Do any additional setup after loading the view. 16 | let view = CodeView.init(frame: CGRect.init(x: 50, y: 160, width: SCREEN_WIDTH-100, height: 50),codeNumber: 6,style: .CodeStyle_border) 17 | view.codeBlock = { [weak self] code in 18 | print("\n\n=======>您输入的验证码是:\(code)") 19 | } 20 | self.view.addSubview(view) 21 | } 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeViewTests/CodeViewTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CodeViewTests.swift 3 | // CodeViewTests 4 | // 5 | // Created by zksz on 2019/9/2. 6 | // Copyright © 2019 zksz. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import CodeView 11 | 12 | class CodeViewTests: XCTestCase { 13 | 14 | override func setUp() { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | func testExample() { 23 | // This is an example of a functional test case. 24 | // Use XCTAssert and related functions to verify your tests produce the correct results. 25 | } 26 | 27 | func testPerformanceExample() { 28 | // This is an example of a performance test case. 29 | self.measure { 30 | // Put the code you want to measure the time of here. 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeViewTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeViewUITests/CodeViewUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CodeViewUITests.swift 3 | // CodeViewUITests 4 | // 5 | // Created by zksz on 2019/9/2. 6 | // Copyright © 2019 zksz. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class CodeViewUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | 16 | // In UI tests it is usually best to stop immediately when a failure occurs. 17 | continueAfterFailure = false 18 | 19 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 20 | XCUIApplication().launch() 21 | 22 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 23 | } 24 | 25 | override func tearDown() { 26 | // Put teardown code here. This method is called after the invocation of each test method in the class. 27 | } 28 | 29 | func testExample() { 30 | // Use recording to get started writing UI tests. 31 | // Use XCTAssert and related functions to verify your tests produce the correct results. 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /CodeView_Swift_Demo/CodeViewUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CodeView 2 | 3 | ## 新增cocoapods支持 4 | **更新说明** 5 | 现在已经支持pod集成 [Sam_CodeVIew](https://github.com/SamXZP/Sam_CodeView) 6 | ``` 7 | source 'https://github.com/SamXZP/Sam_CodeViewSpec.git' //在podfile 里面加上私有库源 8 | pod 'Sam_CodeView', '1.0.1' 9 | ``` 10 | 11 | ### 预览图 12 | 13 | ![line](https://github.com/Mebsunny/CodeView/blob/master/Screenshot/line.png?raw=true) 14 | 15 | ![border](https://github.com/Mebsunny/CodeView/blob/master/Screenshot/border.png?raw=true) 16 | 17 | ### 说明 18 | 19 | `CodeView` 是一个可以高度自定义手机验证码输入的控件。 20 | 21 | 项目有 [swift](https://github.com/Mebsunny/CodeView/tree/master/CodeView_Swift_Demo) 和 [Objective-C ](https://github.com/Mebsunny/CodeView/tree/master/CodeView_OC_Demo) 两个版本,可根据自己的项目语言引入工程。 22 | 23 | 下面介绍下`CodeView`**swift版本**的原理和用法,**Objective-C 版本**原理一样就不单独介绍了,[CodeView_OC_Demo](https://github.com/Mebsunny/CodeView/tree/master/CodeView_OC_Demo)里面很详细的介绍了Objective-C 的用法和原理。 24 | 25 | **原理:** 基于UITextField,使用UILabel来代替验证码的显示,使用CAShapeLayer代替光标的显示,使用CALayer绘制底部线条。根据UITextField的文字变化的监听,去改变光标的显示位置和验证码的下划线或边框的风格。 26 | 27 | ### 使用方法 28 | 29 | **Clone或者download到本地,然后把CodeView.swift文件拖到自己的项目,下面是使用方法:** 30 | 31 | ```swift 32 | let view = CodeView.init(frame: CGRect.init(x: 50, y: 160, width: SCREEN_WIDTH-100, height: 50),codeNumber: 4,style: .CodeStyle_line) 33 | view.codeBlock = { [weak self] code in 34 | print("\n\n=======>您输入的验证码是:\(code)") 35 | } 36 | self.view.addSubview(view) 37 | ``` 38 | 39 | 自定义属性介绍: 40 | 41 | `codeNumber` 验证码的长度,一般是4/6位 默认6位 42 | 43 | `margin` CodeView 两个验证码之间的间距,可以自定义,默认12 44 | 45 | `style` 验证码输入的风格,可根据自己的需求选择 46 | 47 | `labelFont` 验证码字体大小 48 | 49 | `labelTextColor` 验证码字体颜色 50 | 51 | `mainColor` 光标颜色和输入验证码的边框、线条颜色 52 | 53 | `normalColor` 未选中的颜色 54 | 55 | ### 主要代码 56 | 57 | **根据UITextField的text改变,移动光标** 58 | 59 | ```swift 60 | @objc func textChage(_ textField: UITextField) { 61 | var verStr:String = textField.text ?? "" 62 | if verStr.count > codeNumber { 63 | let substring = textField.text?.prefix(codeNumber) 64 | textField.text = String(substring ?? "") 65 | verStr = textField.text ?? "" 66 | } 67 | if verStr.count >= codeNumber { 68 | if (self.codeBlock != nil) { 69 | self.codeBlock?(textField.text ?? "") 70 | } 71 | } 72 | 73 | for index in 0.. verStr.count ? false : true) 84 | } 85 | } 86 | ``` 87 | 88 | ### 其他 89 | 90 | 如果遇到问题可以联系我的邮箱:gztzxzp@gmail.com 91 | -------------------------------------------------------------------------------- /Screenshot/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamXZP/CodeView/728f2f4e825832da02efa595a86a1d0d2a713225/Screenshot/.DS_Store -------------------------------------------------------------------------------- /Screenshot/border.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamXZP/CodeView/728f2f4e825832da02efa595a86a1d0d2a713225/Screenshot/border.png -------------------------------------------------------------------------------- /Screenshot/line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamXZP/CodeView/728f2f4e825832da02efa595a86a1d0d2a713225/Screenshot/line.png --------------------------------------------------------------------------------