├── .gitignore ├── LICENSE ├── Mockingbird-Objective-C ├── Mockingbird-Objective-C.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── Mockingbird-Objective-C │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── CloseModalImage.imageset │ │ │ ├── Contents.json │ │ │ ├── iconfont-close-1.png │ │ │ ├── iconfont-close.png │ │ │ └── iconfont-close@3x.png │ ├── Info.plist │ ├── Mockingbird_Objective_C-Bridging-Header.h │ ├── ViewController.h │ ├── ViewController.m │ ├── main.m │ └── mockingbird │ │ ├── Mockingbird.storyboard │ │ ├── Mockingbird.swift │ │ └── MockingbirdScanCodeManager.swift └── Mockingbird-Objective-CTests │ ├── Info.plist │ └── Mockingbird_Objective_CTests.m ├── Mockingbird.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── Mockingbird ├── Mockingbird.storyboard ├── Mockingbird.swift └── MockingbirdScanCodeManager.swift ├── MockingbirdDemo ├── AppDelegate.swift ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-40@2x.png │ │ ├── Icon-40@3x.png │ │ ├── Icon-60@2x.png │ │ ├── Icon-60@3x.png │ │ ├── Icon-Small@2x.png │ │ └── Icon-Small@3x.png │ └── CloseModalImage.imageset │ │ ├── Contents.json │ │ ├── iconfont-close-1.png │ │ ├── iconfont-close.png │ │ └── iconfont-close@3x.png ├── Info.plist └── ViewController.swift ├── MockingbirdTests ├── Info.plist └── MockingbirdTests.swift ├── README.md └── animal-162020_640.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Node.js modules 2 | node_modules/* 3 | 4 | # Compiled Python files 5 | *.pyc 6 | 7 | # Folder view configuration files 8 | .DS_Store 9 | Desktop.ini 10 | 11 | # Thumbnail cache files 12 | ._* 13 | Thumbs.db 14 | 15 | # Files that might appear on external disks 16 | .Spotlight-V100 17 | .Trashes 18 | 19 | # Exclude the Podspecs 20 | Pods/* 21 | # Podfile.lock should not be ignored. 22 | # See also https://github.com/thoughtbot/liftoff/issues/30 23 | # Podfile.lock 24 | 25 | # Exclude any PSD/AI source 26 | #*.psd 27 | #*.ai 28 | 29 | # Exclude generated files 30 | VersionX-revision.h 31 | 32 | # Exclude the build products 33 | build/* 34 | build.output 35 | pkg/* 36 | *.o 37 | 38 | # Exclude temp nibs and swap files 39 | *~.nib 40 | *.swp 41 | *~ 42 | 43 | # Sparkle distribution Private Key (Don't check me in!) 44 | dsa_priv.pem 45 | 46 | # Exclude user-specific XCode 3 and 4 files 47 | *.mode1 48 | *.mode1v3 49 | *.mode2v3 50 | *.perspective 51 | *.perspectivev3 52 | *.pbxuser 53 | *.xcuserdatad 54 | *.xccheckout 55 | xcuserdata 56 | profile 57 | DerivedData 58 | 59 | # Exclude ReleaseNotes 60 | RELEASENOTES 61 | RELEASENOTES.* 62 | release_notes 63 | release_notes.* 64 | 65 | # Other source repository archive directories (protects when importing) 66 | .hg 67 | .svn 68 | CVS 69 | 70 | # idea project files 71 | .idea 72 | *.hmap 73 | 74 | # twistd pid files 75 | twistd.pid 76 | 77 | # Rails 78 | # Ignore bundler config. 79 | .bundle 80 | 81 | # Ignore the default SQLite database. 82 | db/*.sqlite3 83 | db/*.sqlite3-journal 84 | 85 | # Ignore all logfiles and templates. 86 | log/*.log 87 | tmp 88 | 89 | # Ignore vendor cache 90 | vendor/cache 91 | Pods/ 92 | libWeChatSDK.a 93 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mockingbird 2 | https://github.com/lcepy/Mockingbird 3 | 4 | Copyright (C) 2015 http://lcepy.github.io/ 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 173FB6741B31239E00A38F0A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 173FB6731B31239E00A38F0A /* main.m */; }; 11 | 173FB6771B31239E00A38F0A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 173FB6761B31239E00A38F0A /* AppDelegate.m */; }; 12 | 173FB67A1B31239E00A38F0A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 173FB6791B31239E00A38F0A /* ViewController.m */; }; 13 | 173FB67D1B31239E00A38F0A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 173FB67B1B31239E00A38F0A /* Main.storyboard */; }; 14 | 173FB67F1B31239E00A38F0A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 173FB67E1B31239E00A38F0A /* Images.xcassets */; }; 15 | 173FB6821B31239E00A38F0A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 173FB6801B31239E00A38F0A /* LaunchScreen.xib */; }; 16 | 173FB68E1B31239E00A38F0A /* Mockingbird_Objective_CTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 173FB68D1B31239E00A38F0A /* Mockingbird_Objective_CTests.m */; }; 17 | 173FB6A41B3127F500A38F0A /* Mockingbird.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 173FB6A11B3127F500A38F0A /* Mockingbird.storyboard */; }; 18 | 173FB6A51B3127F500A38F0A /* Mockingbird.swift in Sources */ = {isa = PBXBuildFile; fileRef = 173FB6A21B3127F500A38F0A /* Mockingbird.swift */; }; 19 | 173FB6A61B3127F500A38F0A /* MockingbirdScanCodeManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 173FB6A31B3127F500A38F0A /* MockingbirdScanCodeManager.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 173FB6881B31239E00A38F0A /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 173FB6661B31239E00A38F0A /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 173FB66D1B31239E00A38F0A; 28 | remoteInfo = "Mockingbird-Objective-C"; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 173FB66E1B31239E00A38F0A /* Mockingbird-Objective-C.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Mockingbird-Objective-C.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 173FB6721B31239E00A38F0A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 173FB6731B31239E00A38F0A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | 173FB6751B31239E00A38F0A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | 173FB6761B31239E00A38F0A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | 173FB6781B31239E00A38F0A /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 39 | 173FB6791B31239E00A38F0A /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 40 | 173FB67C1B31239E00A38F0A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | 173FB67E1B31239E00A38F0A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 42 | 173FB6811B31239E00A38F0A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 43 | 173FB6871B31239E00A38F0A /* Mockingbird-Objective-CTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Mockingbird-Objective-CTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 173FB68C1B31239E00A38F0A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | 173FB68D1B31239E00A38F0A /* Mockingbird_Objective_CTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Mockingbird_Objective_CTests.m; sourceTree = ""; }; 46 | 173FB6A11B3127F500A38F0A /* Mockingbird.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Mockingbird.storyboard; sourceTree = ""; }; 47 | 173FB6A21B3127F500A38F0A /* Mockingbird.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mockingbird.swift; sourceTree = ""; }; 48 | 173FB6A31B3127F500A38F0A /* MockingbirdScanCodeManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockingbirdScanCodeManager.swift; sourceTree = ""; }; 49 | 173FB6BE1B312FD900A38F0A /* Mockingbird_Objective_C-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Mockingbird_Objective_C-Bridging-Header.h"; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | 173FB66B1B31239E00A38F0A /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | 173FB6841B31239E00A38F0A /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | /* End PBXFrameworksBuildPhase section */ 68 | 69 | /* Begin PBXGroup section */ 70 | 173FB6651B31239E00A38F0A = { 71 | isa = PBXGroup; 72 | children = ( 73 | 173FB6701B31239E00A38F0A /* Mockingbird-Objective-C */, 74 | 173FB68A1B31239E00A38F0A /* Mockingbird-Objective-CTests */, 75 | 173FB66F1B31239E00A38F0A /* Products */, 76 | ); 77 | sourceTree = ""; 78 | }; 79 | 173FB66F1B31239E00A38F0A /* Products */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 173FB66E1B31239E00A38F0A /* Mockingbird-Objective-C.app */, 83 | 173FB6871B31239E00A38F0A /* Mockingbird-Objective-CTests.xctest */, 84 | ); 85 | name = Products; 86 | sourceTree = ""; 87 | }; 88 | 173FB6701B31239E00A38F0A /* Mockingbird-Objective-C */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 173FB6751B31239E00A38F0A /* AppDelegate.h */, 92 | 173FB6761B31239E00A38F0A /* AppDelegate.m */, 93 | 173FB6781B31239E00A38F0A /* ViewController.h */, 94 | 173FB6791B31239E00A38F0A /* ViewController.m */, 95 | 173FB67B1B31239E00A38F0A /* Main.storyboard */, 96 | 173FB67E1B31239E00A38F0A /* Images.xcassets */, 97 | 173FB6801B31239E00A38F0A /* LaunchScreen.xib */, 98 | 173FB6A01B3127F500A38F0A /* mockingbird */, 99 | 173FB6711B31239E00A38F0A /* Supporting Files */, 100 | 173FB6BE1B312FD900A38F0A /* Mockingbird_Objective_C-Bridging-Header.h */, 101 | ); 102 | path = "Mockingbird-Objective-C"; 103 | sourceTree = ""; 104 | }; 105 | 173FB6711B31239E00A38F0A /* Supporting Files */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 173FB6721B31239E00A38F0A /* Info.plist */, 109 | 173FB6731B31239E00A38F0A /* main.m */, 110 | ); 111 | name = "Supporting Files"; 112 | sourceTree = ""; 113 | }; 114 | 173FB68A1B31239E00A38F0A /* Mockingbird-Objective-CTests */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 173FB68D1B31239E00A38F0A /* Mockingbird_Objective_CTests.m */, 118 | 173FB68B1B31239E00A38F0A /* Supporting Files */, 119 | ); 120 | path = "Mockingbird-Objective-CTests"; 121 | sourceTree = ""; 122 | }; 123 | 173FB68B1B31239E00A38F0A /* Supporting Files */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | 173FB68C1B31239E00A38F0A /* Info.plist */, 127 | ); 128 | name = "Supporting Files"; 129 | sourceTree = ""; 130 | }; 131 | 173FB6A01B3127F500A38F0A /* mockingbird */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 173FB6A11B3127F500A38F0A /* Mockingbird.storyboard */, 135 | 173FB6A21B3127F500A38F0A /* Mockingbird.swift */, 136 | 173FB6A31B3127F500A38F0A /* MockingbirdScanCodeManager.swift */, 137 | ); 138 | path = mockingbird; 139 | sourceTree = ""; 140 | }; 141 | /* End PBXGroup section */ 142 | 143 | /* Begin PBXNativeTarget section */ 144 | 173FB66D1B31239E00A38F0A /* Mockingbird-Objective-C */ = { 145 | isa = PBXNativeTarget; 146 | buildConfigurationList = 173FB6911B31239E00A38F0A /* Build configuration list for PBXNativeTarget "Mockingbird-Objective-C" */; 147 | buildPhases = ( 148 | 173FB66A1B31239E00A38F0A /* Sources */, 149 | 173FB66B1B31239E00A38F0A /* Frameworks */, 150 | 173FB66C1B31239E00A38F0A /* Resources */, 151 | ); 152 | buildRules = ( 153 | ); 154 | dependencies = ( 155 | ); 156 | name = "Mockingbird-Objective-C"; 157 | productName = "Mockingbird-Objective-C"; 158 | productReference = 173FB66E1B31239E00A38F0A /* Mockingbird-Objective-C.app */; 159 | productType = "com.apple.product-type.application"; 160 | }; 161 | 173FB6861B31239E00A38F0A /* Mockingbird-Objective-CTests */ = { 162 | isa = PBXNativeTarget; 163 | buildConfigurationList = 173FB6941B31239E00A38F0A /* Build configuration list for PBXNativeTarget "Mockingbird-Objective-CTests" */; 164 | buildPhases = ( 165 | 173FB6831B31239E00A38F0A /* Sources */, 166 | 173FB6841B31239E00A38F0A /* Frameworks */, 167 | 173FB6851B31239E00A38F0A /* Resources */, 168 | ); 169 | buildRules = ( 170 | ); 171 | dependencies = ( 172 | 173FB6891B31239E00A38F0A /* PBXTargetDependency */, 173 | ); 174 | name = "Mockingbird-Objective-CTests"; 175 | productName = "Mockingbird-Objective-CTests"; 176 | productReference = 173FB6871B31239E00A38F0A /* Mockingbird-Objective-CTests.xctest */; 177 | productType = "com.apple.product-type.bundle.unit-test"; 178 | }; 179 | /* End PBXNativeTarget section */ 180 | 181 | /* Begin PBXProject section */ 182 | 173FB6661B31239E00A38F0A /* Project object */ = { 183 | isa = PBXProject; 184 | attributes = { 185 | LastUpgradeCheck = 0630; 186 | ORGANIZATIONNAME = xiangwenwen; 187 | TargetAttributes = { 188 | 173FB66D1B31239E00A38F0A = { 189 | CreatedOnToolsVersion = 6.3.2; 190 | }; 191 | 173FB6861B31239E00A38F0A = { 192 | CreatedOnToolsVersion = 6.3.2; 193 | TestTargetID = 173FB66D1B31239E00A38F0A; 194 | }; 195 | }; 196 | }; 197 | buildConfigurationList = 173FB6691B31239E00A38F0A /* Build configuration list for PBXProject "Mockingbird-Objective-C" */; 198 | compatibilityVersion = "Xcode 3.2"; 199 | developmentRegion = English; 200 | hasScannedForEncodings = 0; 201 | knownRegions = ( 202 | en, 203 | Base, 204 | ); 205 | mainGroup = 173FB6651B31239E00A38F0A; 206 | productRefGroup = 173FB66F1B31239E00A38F0A /* Products */; 207 | projectDirPath = ""; 208 | projectRoot = ""; 209 | targets = ( 210 | 173FB66D1B31239E00A38F0A /* Mockingbird-Objective-C */, 211 | 173FB6861B31239E00A38F0A /* Mockingbird-Objective-CTests */, 212 | ); 213 | }; 214 | /* End PBXProject section */ 215 | 216 | /* Begin PBXResourcesBuildPhase section */ 217 | 173FB66C1B31239E00A38F0A /* Resources */ = { 218 | isa = PBXResourcesBuildPhase; 219 | buildActionMask = 2147483647; 220 | files = ( 221 | 173FB67D1B31239E00A38F0A /* Main.storyboard in Resources */, 222 | 173FB6821B31239E00A38F0A /* LaunchScreen.xib in Resources */, 223 | 173FB6A41B3127F500A38F0A /* Mockingbird.storyboard in Resources */, 224 | 173FB67F1B31239E00A38F0A /* Images.xcassets in Resources */, 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | 173FB6851B31239E00A38F0A /* Resources */ = { 229 | isa = PBXResourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | ); 233 | runOnlyForDeploymentPostprocessing = 0; 234 | }; 235 | /* End PBXResourcesBuildPhase section */ 236 | 237 | /* Begin PBXSourcesBuildPhase section */ 238 | 173FB66A1B31239E00A38F0A /* Sources */ = { 239 | isa = PBXSourcesBuildPhase; 240 | buildActionMask = 2147483647; 241 | files = ( 242 | 173FB67A1B31239E00A38F0A /* ViewController.m in Sources */, 243 | 173FB6A61B3127F500A38F0A /* MockingbirdScanCodeManager.swift in Sources */, 244 | 173FB6A51B3127F500A38F0A /* Mockingbird.swift in Sources */, 245 | 173FB6771B31239E00A38F0A /* AppDelegate.m in Sources */, 246 | 173FB6741B31239E00A38F0A /* main.m in Sources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | 173FB6831B31239E00A38F0A /* Sources */ = { 251 | isa = PBXSourcesBuildPhase; 252 | buildActionMask = 2147483647; 253 | files = ( 254 | 173FB68E1B31239E00A38F0A /* Mockingbird_Objective_CTests.m in Sources */, 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | }; 258 | /* End PBXSourcesBuildPhase section */ 259 | 260 | /* Begin PBXTargetDependency section */ 261 | 173FB6891B31239E00A38F0A /* PBXTargetDependency */ = { 262 | isa = PBXTargetDependency; 263 | target = 173FB66D1B31239E00A38F0A /* Mockingbird-Objective-C */; 264 | targetProxy = 173FB6881B31239E00A38F0A /* PBXContainerItemProxy */; 265 | }; 266 | /* End PBXTargetDependency section */ 267 | 268 | /* Begin PBXVariantGroup section */ 269 | 173FB67B1B31239E00A38F0A /* Main.storyboard */ = { 270 | isa = PBXVariantGroup; 271 | children = ( 272 | 173FB67C1B31239E00A38F0A /* Base */, 273 | ); 274 | name = Main.storyboard; 275 | sourceTree = ""; 276 | }; 277 | 173FB6801B31239E00A38F0A /* LaunchScreen.xib */ = { 278 | isa = PBXVariantGroup; 279 | children = ( 280 | 173FB6811B31239E00A38F0A /* Base */, 281 | ); 282 | name = LaunchScreen.xib; 283 | sourceTree = ""; 284 | }; 285 | /* End PBXVariantGroup section */ 286 | 287 | /* Begin XCBuildConfiguration section */ 288 | 173FB68F1B31239E00A38F0A /* Debug */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ALWAYS_SEARCH_USER_PATHS = NO; 292 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 293 | CLANG_CXX_LIBRARY = "libc++"; 294 | CLANG_ENABLE_MODULES = YES; 295 | CLANG_ENABLE_OBJC_ARC = YES; 296 | CLANG_WARN_BOOL_CONVERSION = YES; 297 | CLANG_WARN_CONSTANT_CONVERSION = YES; 298 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 299 | CLANG_WARN_EMPTY_BODY = YES; 300 | CLANG_WARN_ENUM_CONVERSION = YES; 301 | CLANG_WARN_INT_CONVERSION = YES; 302 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 303 | CLANG_WARN_UNREACHABLE_CODE = YES; 304 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 305 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 306 | COPY_PHASE_STRIP = NO; 307 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 308 | ENABLE_STRICT_OBJC_MSGSEND = YES; 309 | GCC_C_LANGUAGE_STANDARD = gnu99; 310 | GCC_DYNAMIC_NO_PIC = NO; 311 | GCC_NO_COMMON_BLOCKS = YES; 312 | GCC_OPTIMIZATION_LEVEL = 0; 313 | GCC_PREPROCESSOR_DEFINITIONS = ( 314 | "DEBUG=1", 315 | "$(inherited)", 316 | ); 317 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 318 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 319 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 320 | GCC_WARN_UNDECLARED_SELECTOR = YES; 321 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 322 | GCC_WARN_UNUSED_FUNCTION = YES; 323 | GCC_WARN_UNUSED_VARIABLE = YES; 324 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 325 | MTL_ENABLE_DEBUG_INFO = YES; 326 | ONLY_ACTIVE_ARCH = YES; 327 | SDKROOT = iphoneos; 328 | }; 329 | name = Debug; 330 | }; 331 | 173FB6901B31239E00A38F0A /* Release */ = { 332 | isa = XCBuildConfiguration; 333 | buildSettings = { 334 | ALWAYS_SEARCH_USER_PATHS = NO; 335 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 336 | CLANG_CXX_LIBRARY = "libc++"; 337 | CLANG_ENABLE_MODULES = YES; 338 | CLANG_ENABLE_OBJC_ARC = YES; 339 | CLANG_WARN_BOOL_CONVERSION = YES; 340 | CLANG_WARN_CONSTANT_CONVERSION = YES; 341 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 342 | CLANG_WARN_EMPTY_BODY = YES; 343 | CLANG_WARN_ENUM_CONVERSION = YES; 344 | CLANG_WARN_INT_CONVERSION = YES; 345 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 346 | CLANG_WARN_UNREACHABLE_CODE = YES; 347 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 348 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 349 | COPY_PHASE_STRIP = NO; 350 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 351 | ENABLE_NS_ASSERTIONS = NO; 352 | ENABLE_STRICT_OBJC_MSGSEND = YES; 353 | GCC_C_LANGUAGE_STANDARD = gnu99; 354 | GCC_NO_COMMON_BLOCKS = YES; 355 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 356 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 357 | GCC_WARN_UNDECLARED_SELECTOR = YES; 358 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 359 | GCC_WARN_UNUSED_FUNCTION = YES; 360 | GCC_WARN_UNUSED_VARIABLE = YES; 361 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 362 | MTL_ENABLE_DEBUG_INFO = NO; 363 | SDKROOT = iphoneos; 364 | VALIDATE_PRODUCT = YES; 365 | }; 366 | name = Release; 367 | }; 368 | 173FB6921B31239E00A38F0A /* Debug */ = { 369 | isa = XCBuildConfiguration; 370 | buildSettings = { 371 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 372 | DEFINES_MODULE = YES; 373 | INFOPLIST_FILE = "Mockingbird-Objective-C/Info.plist"; 374 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 375 | PRODUCT_NAME = "$(TARGET_NAME)"; 376 | SWIFT_OBJC_BRIDGING_HEADER = "Mockingbird-Objective-C/Mockingbird_Objective_C-Bridging-Header.h"; 377 | }; 378 | name = Debug; 379 | }; 380 | 173FB6931B31239E00A38F0A /* Release */ = { 381 | isa = XCBuildConfiguration; 382 | buildSettings = { 383 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 384 | DEFINES_MODULE = YES; 385 | INFOPLIST_FILE = "Mockingbird-Objective-C/Info.plist"; 386 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 387 | PRODUCT_NAME = "$(TARGET_NAME)"; 388 | SWIFT_OBJC_BRIDGING_HEADER = "Mockingbird-Objective-C/Mockingbird_Objective_C-Bridging-Header.h"; 389 | }; 390 | name = Release; 391 | }; 392 | 173FB6951B31239E00A38F0A /* Debug */ = { 393 | isa = XCBuildConfiguration; 394 | buildSettings = { 395 | BUNDLE_LOADER = "$(TEST_HOST)"; 396 | FRAMEWORK_SEARCH_PATHS = ( 397 | "$(SDKROOT)/Developer/Library/Frameworks", 398 | "$(inherited)", 399 | ); 400 | GCC_PREPROCESSOR_DEFINITIONS = ( 401 | "DEBUG=1", 402 | "$(inherited)", 403 | ); 404 | INFOPLIST_FILE = "Mockingbird-Objective-CTests/Info.plist"; 405 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 406 | PRODUCT_NAME = "$(TARGET_NAME)"; 407 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Mockingbird-Objective-C.app/Mockingbird-Objective-C"; 408 | }; 409 | name = Debug; 410 | }; 411 | 173FB6961B31239E00A38F0A /* Release */ = { 412 | isa = XCBuildConfiguration; 413 | buildSettings = { 414 | BUNDLE_LOADER = "$(TEST_HOST)"; 415 | FRAMEWORK_SEARCH_PATHS = ( 416 | "$(SDKROOT)/Developer/Library/Frameworks", 417 | "$(inherited)", 418 | ); 419 | INFOPLIST_FILE = "Mockingbird-Objective-CTests/Info.plist"; 420 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 421 | PRODUCT_NAME = "$(TARGET_NAME)"; 422 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Mockingbird-Objective-C.app/Mockingbird-Objective-C"; 423 | }; 424 | name = Release; 425 | }; 426 | /* End XCBuildConfiguration section */ 427 | 428 | /* Begin XCConfigurationList section */ 429 | 173FB6691B31239E00A38F0A /* Build configuration list for PBXProject "Mockingbird-Objective-C" */ = { 430 | isa = XCConfigurationList; 431 | buildConfigurations = ( 432 | 173FB68F1B31239E00A38F0A /* Debug */, 433 | 173FB6901B31239E00A38F0A /* Release */, 434 | ); 435 | defaultConfigurationIsVisible = 0; 436 | defaultConfigurationName = Release; 437 | }; 438 | 173FB6911B31239E00A38F0A /* Build configuration list for PBXNativeTarget "Mockingbird-Objective-C" */ = { 439 | isa = XCConfigurationList; 440 | buildConfigurations = ( 441 | 173FB6921B31239E00A38F0A /* Debug */, 442 | 173FB6931B31239E00A38F0A /* Release */, 443 | ); 444 | defaultConfigurationIsVisible = 0; 445 | }; 446 | 173FB6941B31239E00A38F0A /* Build configuration list for PBXNativeTarget "Mockingbird-Objective-CTests" */ = { 447 | isa = XCConfigurationList; 448 | buildConfigurations = ( 449 | 173FB6951B31239E00A38F0A /* Debug */, 450 | 173FB6961B31239E00A38F0A /* Release */, 451 | ); 452 | defaultConfigurationIsVisible = 0; 453 | }; 454 | /* End XCConfigurationList section */ 455 | }; 456 | rootObject = 173FB6661B31239E00A38F0A /* Project object */; 457 | } 458 | -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Mockingbird-Objective-C 4 | // 5 | // Created by xiangwenwen on 15/6/17. 6 | // Copyright (c) 2015年 xiangwenwen. 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 | -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Mockingbird-Objective-C 4 | // 5 | // Created by xiangwenwen on 15/6/17. 6 | // Copyright (c) 2015年 xiangwenwen. 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 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 28 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/Images.xcassets/CloseModalImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "iconfont-close.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "iconfont-close-1.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "iconfont-close@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/Images.xcassets/CloseModalImage.imageset/iconfont-close-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightningminers/Mockingbird/9ab7e278ba8074d27e25a272301844d9271a1425/Mockingbird-Objective-C/Mockingbird-Objective-C/Images.xcassets/CloseModalImage.imageset/iconfont-close-1.png -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/Images.xcassets/CloseModalImage.imageset/iconfont-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightningminers/Mockingbird/9ab7e278ba8074d27e25a272301844d9271a1425/Mockingbird-Objective-C/Mockingbird-Objective-C/Images.xcassets/CloseModalImage.imageset/iconfont-close.png -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/Images.xcassets/CloseModalImage.imageset/iconfont-close@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightningminers/Mockingbird/9ab7e278ba8074d27e25a272301844d9271a1425/Mockingbird-Objective-C/Mockingbird-Objective-C/Images.xcassets/CloseModalImage.imageset/iconfont-close@3x.png -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | wen.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/Mockingbird_Objective_C-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // Mockingbird-Objective-C 4 | // 5 | // Created by xiangwenwen on 15/6/17. 6 | // Copyright (c) 2015年 xiangwenwen. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // Mockingbird-Objective-C 4 | // 5 | // Created by xiangwenwen on 15/6/17. 6 | // Copyright (c) 2015年 xiangwenwen. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "Mockingbird_Objective_C-Swift.h" 11 | 12 | @interface ViewController () 13 | 14 | @property (weak, nonatomic) IBOutlet UILabel *showScanCodeInfo; 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view, typically from a nib. 22 | self.showScanCodeInfo.numberOfLines = 0; 23 | } 24 | 25 | - (void)didReceiveMemoryWarning { 26 | [super didReceiveMemoryWarning]; 27 | // Dispose of any resources that can be recreated. 28 | } 29 | - (IBAction)scanCode:(UIButton *)sender { 30 | UIStoryboard *stor = [UIStoryboard storyboardWithName:@"Mockingbird" bundle:[NSBundle mainBundle]]; 31 | UINavigationController *navc = [stor instantiateViewControllerWithIdentifier:@"MockingbirdNavigationID"]; 32 | MockingbirdScanCodeManager *mocking = (MockingbirdScanCodeManager *)navc.topViewController; 33 | mocking.mockingbirdResult = ^(NSString * __nonnull value){ 34 | self.showScanCodeInfo.text = value; 35 | }; 36 | [self presentViewController:navc animated:YES completion:nil]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Mockingbird-Objective-C 4 | // 5 | // Created by xiangwenwen on 15/6/17. 6 | // Copyright (c) 2015年 xiangwenwen. 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 | -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/mockingbird/Mockingbird.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/mockingbird/Mockingbird.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Mockingbird.swift 3 | // Mockingbird 4 | // 5 | // Created by xiangwenwen on 15/6/16. 6 | // Copyright (c) 2015年 xiangwenwen. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | let MOKTeal:UIColor = UIColor(red: 0.000, green: 0.502, blue: 0.502, alpha: 1.000) 13 | let MOKOrchid:UIColor = UIColor(red: 0.400, green: 0.400, blue: 1.000, alpha: 1.000) 14 | let MOKCantaloupe:UIColor = UIColor(red: 1.000, green: 0.800, blue: 0.400, alpha: 1.000) 15 | let MOKSky:UIColor = UIColor(red: 0.400, green: 0.800, blue: 1.000, alpha: 1.000) 16 | let MOKLavender:UIColor = UIColor(red: 0.800, green: 0.400, blue: 1.000, alpha: 1.000) 17 | let MOKSnow:UIColor = UIColor.whiteColor() 18 | 19 | let MOKWidth:CGFloat = UIScreen.mainScreen().bounds.width 20 | let MOKHeight:CGFloat = UIScreen.mainScreen().bounds.height 21 | 22 | let MOKNotifiScanResult:String = "MockingbirdResult" -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-C/mockingbird/MockingbirdScanCodeManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MockingbirdScanCodeManager.swift 3 | // Mockingbird 4 | // 5 | // Created by xiangwenwen on 15/6/15. 6 | // Copyright (c) 2015年 xiangwenwen. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | import AVFoundation 12 | 13 | class MockingbirdScanCodeManager:UIViewController,AVCaptureMetadataOutputObjectsDelegate{ 14 | @IBOutlet weak var loadLine: UIActivityIndicatorView! 15 | 16 | var captureSession:AVCaptureSession? 17 | var globalColor:UIColor? 18 | var globalTitle:String? 19 | var previewLineColor:UIColor? 20 | 21 | var videoPreviewLayer:AVCaptureVideoPreviewLayer? 22 | var videoPreviewLineAnimationFrameView:UIView? 23 | var videoPreviewContainsFrameView:UIView? 24 | 25 | var mockingbirdResult:((value:String?)->Void)? 26 | 27 | private var isReading:Bool = false 28 | 29 | override func viewDidLoad() { 30 | super.viewDidLoad() 31 | self.navigationItem.title = self.globalTitle == nil ? "扫描条码" : self.globalTitle 32 | let reminder = UILabel(frame: CGRectMake(0, MOKHeight-80, MOKWidth, 40)) 33 | reminder.textAlignment = NSTextAlignment.Center 34 | reminder.textColor = MOKSnow 35 | reminder.text = "对准要扫描的条码" 36 | reminder.font = UIFont.systemFontOfSize(25.0) 37 | self.view.addSubview(reminder) 38 | self.view.bringSubviewToFront(reminder) 39 | self.handlerViewColor() 40 | // Do any additional setup after loading the view, typically from a nib. 41 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), { () -> Void in 42 | let captureDevice = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo) 43 | var error:NSError? 44 | let input:AnyObject! = AVCaptureDeviceInput.deviceInputWithDevice(captureDevice, error: &error) 45 | if error != nil{ 46 | println("\( error?.localizedDescription)") 47 | }else{ 48 | self.captureSession = AVCaptureSession() 49 | self.captureSession?.addInput(input as! AVCaptureInput) 50 | let captureMetadataOutput = AVCaptureMetadataOutput() 51 | self.captureSession?.addOutput(captureMetadataOutput) 52 | captureMetadataOutput.setMetadataObjectsDelegate(self, queue: dispatch_get_main_queue()) 53 | captureMetadataOutput.metadataObjectTypes = [AVMetadataObjectTypeEAN13Code,AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeCode128Code,AVMetadataObjectTypeQRCode] 54 | println("scan code init") 55 | } 56 | dispatch_async(dispatch_get_main_queue(), { () -> Void in 57 | self.loadLine.hidden = true 58 | self.videoPreviewLayer = AVCaptureVideoPreviewLayer(session: self.captureSession) 59 | self.videoPreviewLayer?.videoGravity = AVLayerVideoGravityResizeAspectFill 60 | self.videoPreviewLayer?.frame = self.view.bounds 61 | self.view.layer.addSublayer(self.videoPreviewLayer) 62 | self.createUIView() 63 | self.captureSession?.startRunning() 64 | reminder.removeFromSuperview() 65 | }) 66 | }) 67 | } 68 | 69 | func captureOutput(captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [AnyObject]!, fromConnection connection: AVCaptureConnection!) { 70 | if metadataObjects == nil || metadataObjects.count == 0{ 71 | self.videoPreviewContainsFrameView?.frame = CGRectZero 72 | println("No QR code is detected") 73 | return 74 | } 75 | self.dismissViewControllerAnimated(true, completion: nil) 76 | if !self.isReading{ 77 | self.isReading = true 78 | let metadata = metadataObjects[0] as! AVMetadataMachineReadableCodeObject 79 | let barCode = self.videoPreviewLayer?.transformedMetadataObjectForMetadataObject(metadata) as! AVMetadataMachineReadableCodeObject 80 | self.videoPreviewContainsFrameView?.frame = barCode.bounds 81 | if self.mockingbirdResult != nil{ 82 | self.mockingbirdResult?(value: metadata.stringValue) 83 | }else{ 84 | NSNotificationCenter.defaultCenter().postNotificationName(MOKNotifiScanResult, object: nil, userInfo: ["value":metadata.stringValue]) 85 | } 86 | } 87 | } 88 | 89 | private func createUIView()->Void{ 90 | self.videoPreviewContainsFrameView = UIView(frame: CGRectMake(MOKWidth/4, (MOKHeight-200)/2, MOKWidth/2, 200)) 91 | self.videoPreviewContainsFrameView?.layer.borderColor = self.globalColor == nil ? MOKOrchid.CGColor : self.globalColor!.CGColor 92 | self.videoPreviewContainsFrameView?.layer.borderWidth = 1 93 | self.view.addSubview(self.videoPreviewContainsFrameView!) 94 | self.view.bringSubviewToFront(self.videoPreviewContainsFrameView!) 95 | self.videoPreviewLineAnimationFrameView = UIView(frame: CGRectMake(0,0, MOKWidth/2, 1)) 96 | self.videoPreviewLineAnimationFrameView?.layer.borderWidth = 1 97 | self.videoPreviewLineAnimationFrameView?.layer.borderColor = self.previewLineColor == nil ? MOKSnow.CGColor : self.previewLineColor?.CGColor 98 | self.videoPreviewContainsFrameView?.addSubview(self.videoPreviewLineAnimationFrameView!) 99 | self.videoPreviewLineAnimation() 100 | var time:NSTimer = NSTimer.scheduledTimerWithTimeInterval(NSTimeInterval(2.0), target: self, selector: "repetitionScanAnimation", userInfo: nil, repeats: true) 101 | let reminder = UILabel(frame: CGRectMake(0, MOKHeight-80, MOKWidth, 40)) 102 | reminder.textAlignment = NSTextAlignment.Center 103 | reminder.textColor = MOKSnow 104 | reminder.text = "对准要扫描的条码" 105 | reminder.font = UIFont.systemFontOfSize(25.0) 106 | self.view.addSubview(reminder) 107 | self.view.bringSubviewToFront(reminder) 108 | } 109 | 110 | func videoPreviewLineAnimation()->Void{ 111 | let animation = CABasicAnimation(keyPath: "MOK") 112 | animation.duration = 2.0 113 | animation.keyPath = "position.y" 114 | animation.toValue = 200 115 | self.videoPreviewLineAnimationFrameView?.layer.addAnimation(animation, forKey: "MOK") 116 | } 117 | 118 | func repetitionScanAnimation()->Void{ 119 | self.videoPreviewLineAnimation() 120 | } 121 | 122 | private func handlerViewColor()->Void{ 123 | if let color = self.globalColor{ 124 | self.navigationController?.navigationBar.barTintColor = color 125 | self.loadLine.color = color 126 | } 127 | } 128 | 129 | @IBAction func cancel(sender: UIBarButtonItem) { 130 | self.dismissViewControllerAnimated(true, completion: nil) 131 | } 132 | override func didReceiveMemoryWarning() { 133 | super.didReceiveMemoryWarning() 134 | // Dispose of any resources that can be recreated. 135 | } 136 | 137 | } 138 | -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-CTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | wen.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Mockingbird-Objective-C/Mockingbird-Objective-CTests/Mockingbird_Objective_CTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Mockingbird_Objective_CTests.m 3 | // Mockingbird-Objective-CTests 4 | // 5 | // Created by xiangwenwen on 15/6/17. 6 | // Copyright (c) 2015年 xiangwenwen. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface Mockingbird_Objective_CTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation Mockingbird_Objective_CTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Mockingbird.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1731D8C51B2FC5CF0058385E /* Mockingbird.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1731D8C41B2FC5CF0058385E /* Mockingbird.swift */; }; 11 | 176F66771B2E6CC90097A9B3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 176F66761B2E6CC90097A9B3 /* AppDelegate.swift */; }; 12 | 176F66791B2E6CC90097A9B3 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 176F66781B2E6CC90097A9B3 /* ViewController.swift */; }; 13 | 176F667E1B2E6CC90097A9B3 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 176F667D1B2E6CC90097A9B3 /* Images.xcassets */; }; 14 | 176F668D1B2E6CC90097A9B3 /* MockingbirdTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 176F668C1B2E6CC90097A9B3 /* MockingbirdTests.swift */; }; 15 | 176F66971B2E6CD90097A9B3 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 176F66961B2E6CD90097A9B3 /* AVFoundation.framework */; }; 16 | 176F669D1B2E71010097A9B3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 176F667A1B2E6CC90097A9B3 /* Main.storyboard */; }; 17 | 176F669E1B2E71060097A9B3 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 176F667F1B2E6CC90097A9B3 /* LaunchScreen.xib */; }; 18 | 176F66A31B2E87AB0097A9B3 /* Mockingbird.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 176F66A21B2E87AB0097A9B3 /* Mockingbird.storyboard */; }; 19 | 176F66A61B2EA4BE0097A9B3 /* MockingbirdScanCodeManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 176F66A51B2EA4BE0097A9B3 /* MockingbirdScanCodeManager.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 176F66871B2E6CC90097A9B3 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 176F66691B2E6CC90097A9B3 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 176F66701B2E6CC90097A9B3; 28 | remoteInfo = Mockingbird; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 1731D8C41B2FC5CF0058385E /* Mockingbird.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mockingbird.swift; sourceTree = ""; }; 34 | 176F66711B2E6CC90097A9B3 /* Mockingbird.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Mockingbird.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | 176F66751B2E6CC90097A9B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | 176F66761B2E6CC90097A9B3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 176F66781B2E6CC90097A9B3 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 38 | 176F667B1B2E6CC90097A9B3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 39 | 176F667D1B2E6CC90097A9B3 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | 176F66801B2E6CC90097A9B3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 41 | 176F66861B2E6CC90097A9B3 /* MockingbirdTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MockingbirdTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 176F668B1B2E6CC90097A9B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | 176F668C1B2E6CC90097A9B3 /* MockingbirdTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockingbirdTests.swift; sourceTree = ""; }; 44 | 176F66961B2E6CD90097A9B3 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 45 | 176F66A21B2E87AB0097A9B3 /* Mockingbird.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Mockingbird.storyboard; sourceTree = ""; }; 46 | 176F66A51B2EA4BE0097A9B3 /* MockingbirdScanCodeManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockingbirdScanCodeManager.swift; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | 176F666E1B2E6CC90097A9B3 /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | 176F66971B2E6CD90097A9B3 /* AVFoundation.framework in Frameworks */, 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | 176F66831B2E6CC90097A9B3 /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 176F66681B2E6CC90097A9B3 = { 69 | isa = PBXGroup; 70 | children = ( 71 | 176F66961B2E6CD90097A9B3 /* AVFoundation.framework */, 72 | 176F66981B2E6D260097A9B3 /* Mockingbird */, 73 | 176F66731B2E6CC90097A9B3 /* MockingbirdDemo */, 74 | 176F66891B2E6CC90097A9B3 /* MockingbirdTests */, 75 | 176F66721B2E6CC90097A9B3 /* Products */, 76 | ); 77 | sourceTree = ""; 78 | }; 79 | 176F66721B2E6CC90097A9B3 /* Products */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 176F66711B2E6CC90097A9B3 /* Mockingbird.app */, 83 | 176F66861B2E6CC90097A9B3 /* MockingbirdTests.xctest */, 84 | ); 85 | name = Products; 86 | sourceTree = ""; 87 | }; 88 | 176F66731B2E6CC90097A9B3 /* MockingbirdDemo */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 176F66761B2E6CC90097A9B3 /* AppDelegate.swift */, 92 | 176F66781B2E6CC90097A9B3 /* ViewController.swift */, 93 | 176F667A1B2E6CC90097A9B3 /* Main.storyboard */, 94 | 176F667D1B2E6CC90097A9B3 /* Images.xcassets */, 95 | 176F667F1B2E6CC90097A9B3 /* LaunchScreen.xib */, 96 | 176F66741B2E6CC90097A9B3 /* Supporting Files */, 97 | ); 98 | path = MockingbirdDemo; 99 | sourceTree = ""; 100 | }; 101 | 176F66741B2E6CC90097A9B3 /* Supporting Files */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 176F66751B2E6CC90097A9B3 /* Info.plist */, 105 | ); 106 | name = "Supporting Files"; 107 | sourceTree = ""; 108 | }; 109 | 176F66891B2E6CC90097A9B3 /* MockingbirdTests */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 176F668C1B2E6CC90097A9B3 /* MockingbirdTests.swift */, 113 | 176F668A1B2E6CC90097A9B3 /* Supporting Files */, 114 | ); 115 | path = MockingbirdTests; 116 | sourceTree = ""; 117 | }; 118 | 176F668A1B2E6CC90097A9B3 /* Supporting Files */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 176F668B1B2E6CC90097A9B3 /* Info.plist */, 122 | ); 123 | name = "Supporting Files"; 124 | sourceTree = ""; 125 | }; 126 | 176F66981B2E6D260097A9B3 /* Mockingbird */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 176F66A21B2E87AB0097A9B3 /* Mockingbird.storyboard */, 130 | 176F66A51B2EA4BE0097A9B3 /* MockingbirdScanCodeManager.swift */, 131 | 1731D8C41B2FC5CF0058385E /* Mockingbird.swift */, 132 | ); 133 | path = Mockingbird; 134 | sourceTree = ""; 135 | }; 136 | /* End PBXGroup section */ 137 | 138 | /* Begin PBXNativeTarget section */ 139 | 176F66701B2E6CC90097A9B3 /* Mockingbird */ = { 140 | isa = PBXNativeTarget; 141 | buildConfigurationList = 176F66901B2E6CC90097A9B3 /* Build configuration list for PBXNativeTarget "Mockingbird" */; 142 | buildPhases = ( 143 | 176F666D1B2E6CC90097A9B3 /* Sources */, 144 | 176F666E1B2E6CC90097A9B3 /* Frameworks */, 145 | 176F666F1B2E6CC90097A9B3 /* Resources */, 146 | ); 147 | buildRules = ( 148 | ); 149 | dependencies = ( 150 | ); 151 | name = Mockingbird; 152 | productName = Mockingbird; 153 | productReference = 176F66711B2E6CC90097A9B3 /* Mockingbird.app */; 154 | productType = "com.apple.product-type.application"; 155 | }; 156 | 176F66851B2E6CC90097A9B3 /* MockingbirdTests */ = { 157 | isa = PBXNativeTarget; 158 | buildConfigurationList = 176F66931B2E6CC90097A9B3 /* Build configuration list for PBXNativeTarget "MockingbirdTests" */; 159 | buildPhases = ( 160 | 176F66821B2E6CC90097A9B3 /* Sources */, 161 | 176F66831B2E6CC90097A9B3 /* Frameworks */, 162 | 176F66841B2E6CC90097A9B3 /* Resources */, 163 | ); 164 | buildRules = ( 165 | ); 166 | dependencies = ( 167 | 176F66881B2E6CC90097A9B3 /* PBXTargetDependency */, 168 | ); 169 | name = MockingbirdTests; 170 | productName = MockingbirdTests; 171 | productReference = 176F66861B2E6CC90097A9B3 /* MockingbirdTests.xctest */; 172 | productType = "com.apple.product-type.bundle.unit-test"; 173 | }; 174 | /* End PBXNativeTarget section */ 175 | 176 | /* Begin PBXProject section */ 177 | 176F66691B2E6CC90097A9B3 /* Project object */ = { 178 | isa = PBXProject; 179 | attributes = { 180 | LastUpgradeCheck = 0630; 181 | ORGANIZATIONNAME = xiangwenwen; 182 | TargetAttributes = { 183 | 176F66701B2E6CC90097A9B3 = { 184 | CreatedOnToolsVersion = 6.3.2; 185 | }; 186 | 176F66851B2E6CC90097A9B3 = { 187 | CreatedOnToolsVersion = 6.3.2; 188 | TestTargetID = 176F66701B2E6CC90097A9B3; 189 | }; 190 | }; 191 | }; 192 | buildConfigurationList = 176F666C1B2E6CC90097A9B3 /* Build configuration list for PBXProject "Mockingbird" */; 193 | compatibilityVersion = "Xcode 3.2"; 194 | developmentRegion = English; 195 | hasScannedForEncodings = 0; 196 | knownRegions = ( 197 | en, 198 | Base, 199 | ); 200 | mainGroup = 176F66681B2E6CC90097A9B3; 201 | productRefGroup = 176F66721B2E6CC90097A9B3 /* Products */; 202 | projectDirPath = ""; 203 | projectRoot = ""; 204 | targets = ( 205 | 176F66701B2E6CC90097A9B3 /* Mockingbird */, 206 | 176F66851B2E6CC90097A9B3 /* MockingbirdTests */, 207 | ); 208 | }; 209 | /* End PBXProject section */ 210 | 211 | /* Begin PBXResourcesBuildPhase section */ 212 | 176F666F1B2E6CC90097A9B3 /* Resources */ = { 213 | isa = PBXResourcesBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | 176F669E1B2E71060097A9B3 /* LaunchScreen.xib in Resources */, 217 | 176F669D1B2E71010097A9B3 /* Main.storyboard in Resources */, 218 | 176F66A31B2E87AB0097A9B3 /* Mockingbird.storyboard in Resources */, 219 | 176F667E1B2E6CC90097A9B3 /* Images.xcassets in Resources */, 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | }; 223 | 176F66841B2E6CC90097A9B3 /* Resources */ = { 224 | isa = PBXResourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | ); 228 | runOnlyForDeploymentPostprocessing = 0; 229 | }; 230 | /* End PBXResourcesBuildPhase section */ 231 | 232 | /* Begin PBXSourcesBuildPhase section */ 233 | 176F666D1B2E6CC90097A9B3 /* Sources */ = { 234 | isa = PBXSourcesBuildPhase; 235 | buildActionMask = 2147483647; 236 | files = ( 237 | 176F66791B2E6CC90097A9B3 /* ViewController.swift in Sources */, 238 | 1731D8C51B2FC5CF0058385E /* Mockingbird.swift in Sources */, 239 | 176F66771B2E6CC90097A9B3 /* AppDelegate.swift in Sources */, 240 | 176F66A61B2EA4BE0097A9B3 /* MockingbirdScanCodeManager.swift in Sources */, 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | }; 244 | 176F66821B2E6CC90097A9B3 /* Sources */ = { 245 | isa = PBXSourcesBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | 176F668D1B2E6CC90097A9B3 /* MockingbirdTests.swift in Sources */, 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | /* End PBXSourcesBuildPhase section */ 253 | 254 | /* Begin PBXTargetDependency section */ 255 | 176F66881B2E6CC90097A9B3 /* PBXTargetDependency */ = { 256 | isa = PBXTargetDependency; 257 | target = 176F66701B2E6CC90097A9B3 /* Mockingbird */; 258 | targetProxy = 176F66871B2E6CC90097A9B3 /* PBXContainerItemProxy */; 259 | }; 260 | /* End PBXTargetDependency section */ 261 | 262 | /* Begin PBXVariantGroup section */ 263 | 176F667A1B2E6CC90097A9B3 /* Main.storyboard */ = { 264 | isa = PBXVariantGroup; 265 | children = ( 266 | 176F667B1B2E6CC90097A9B3 /* Base */, 267 | ); 268 | name = Main.storyboard; 269 | sourceTree = ""; 270 | }; 271 | 176F667F1B2E6CC90097A9B3 /* LaunchScreen.xib */ = { 272 | isa = PBXVariantGroup; 273 | children = ( 274 | 176F66801B2E6CC90097A9B3 /* Base */, 275 | ); 276 | name = LaunchScreen.xib; 277 | sourceTree = ""; 278 | }; 279 | /* End PBXVariantGroup section */ 280 | 281 | /* Begin XCBuildConfiguration section */ 282 | 176F668E1B2E6CC90097A9B3 /* Debug */ = { 283 | isa = XCBuildConfiguration; 284 | buildSettings = { 285 | ALWAYS_SEARCH_USER_PATHS = NO; 286 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 287 | CLANG_CXX_LIBRARY = "libc++"; 288 | CLANG_ENABLE_MODULES = YES; 289 | CLANG_ENABLE_OBJC_ARC = YES; 290 | CLANG_WARN_BOOL_CONVERSION = YES; 291 | CLANG_WARN_CONSTANT_CONVERSION = YES; 292 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 293 | CLANG_WARN_EMPTY_BODY = YES; 294 | CLANG_WARN_ENUM_CONVERSION = YES; 295 | CLANG_WARN_INT_CONVERSION = YES; 296 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 297 | CLANG_WARN_UNREACHABLE_CODE = YES; 298 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 299 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 300 | COPY_PHASE_STRIP = NO; 301 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 302 | ENABLE_STRICT_OBJC_MSGSEND = YES; 303 | GCC_C_LANGUAGE_STANDARD = gnu99; 304 | GCC_DYNAMIC_NO_PIC = NO; 305 | GCC_NO_COMMON_BLOCKS = YES; 306 | GCC_OPTIMIZATION_LEVEL = 0; 307 | GCC_PREPROCESSOR_DEFINITIONS = ( 308 | "DEBUG=1", 309 | "$(inherited)", 310 | ); 311 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 312 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 313 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 314 | GCC_WARN_UNDECLARED_SELECTOR = YES; 315 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 316 | GCC_WARN_UNUSED_FUNCTION = YES; 317 | GCC_WARN_UNUSED_VARIABLE = YES; 318 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 319 | MTL_ENABLE_DEBUG_INFO = YES; 320 | ONLY_ACTIVE_ARCH = YES; 321 | SDKROOT = iphoneos; 322 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 323 | }; 324 | name = Debug; 325 | }; 326 | 176F668F1B2E6CC90097A9B3 /* Release */ = { 327 | isa = XCBuildConfiguration; 328 | buildSettings = { 329 | ALWAYS_SEARCH_USER_PATHS = NO; 330 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 331 | CLANG_CXX_LIBRARY = "libc++"; 332 | CLANG_ENABLE_MODULES = YES; 333 | CLANG_ENABLE_OBJC_ARC = YES; 334 | CLANG_WARN_BOOL_CONVERSION = YES; 335 | CLANG_WARN_CONSTANT_CONVERSION = YES; 336 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 337 | CLANG_WARN_EMPTY_BODY = YES; 338 | CLANG_WARN_ENUM_CONVERSION = YES; 339 | CLANG_WARN_INT_CONVERSION = YES; 340 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 341 | CLANG_WARN_UNREACHABLE_CODE = YES; 342 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 343 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 344 | COPY_PHASE_STRIP = NO; 345 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 346 | ENABLE_NS_ASSERTIONS = NO; 347 | ENABLE_STRICT_OBJC_MSGSEND = YES; 348 | GCC_C_LANGUAGE_STANDARD = gnu99; 349 | GCC_NO_COMMON_BLOCKS = YES; 350 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 351 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 352 | GCC_WARN_UNDECLARED_SELECTOR = YES; 353 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 354 | GCC_WARN_UNUSED_FUNCTION = YES; 355 | GCC_WARN_UNUSED_VARIABLE = YES; 356 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 357 | MTL_ENABLE_DEBUG_INFO = NO; 358 | SDKROOT = iphoneos; 359 | VALIDATE_PRODUCT = YES; 360 | }; 361 | name = Release; 362 | }; 363 | 176F66911B2E6CC90097A9B3 /* Debug */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 367 | INFOPLIST_FILE = MockingbirdDemo/Info.plist; 368 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 369 | PRODUCT_NAME = "$(TARGET_NAME)"; 370 | }; 371 | name = Debug; 372 | }; 373 | 176F66921B2E6CC90097A9B3 /* Release */ = { 374 | isa = XCBuildConfiguration; 375 | buildSettings = { 376 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 377 | INFOPLIST_FILE = MockingbirdDemo/Info.plist; 378 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 379 | PRODUCT_NAME = "$(TARGET_NAME)"; 380 | }; 381 | name = Release; 382 | }; 383 | 176F66941B2E6CC90097A9B3 /* Debug */ = { 384 | isa = XCBuildConfiguration; 385 | buildSettings = { 386 | BUNDLE_LOADER = "$(TEST_HOST)"; 387 | FRAMEWORK_SEARCH_PATHS = ( 388 | "$(SDKROOT)/Developer/Library/Frameworks", 389 | "$(inherited)", 390 | ); 391 | GCC_PREPROCESSOR_DEFINITIONS = ( 392 | "DEBUG=1", 393 | "$(inherited)", 394 | ); 395 | INFOPLIST_FILE = MockingbirdTests/Info.plist; 396 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 397 | PRODUCT_NAME = "$(TARGET_NAME)"; 398 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Mockingbird.app/Mockingbird"; 399 | }; 400 | name = Debug; 401 | }; 402 | 176F66951B2E6CC90097A9B3 /* Release */ = { 403 | isa = XCBuildConfiguration; 404 | buildSettings = { 405 | BUNDLE_LOADER = "$(TEST_HOST)"; 406 | FRAMEWORK_SEARCH_PATHS = ( 407 | "$(SDKROOT)/Developer/Library/Frameworks", 408 | "$(inherited)", 409 | ); 410 | INFOPLIST_FILE = MockingbirdTests/Info.plist; 411 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 412 | PRODUCT_NAME = "$(TARGET_NAME)"; 413 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Mockingbird.app/Mockingbird"; 414 | }; 415 | name = Release; 416 | }; 417 | /* End XCBuildConfiguration section */ 418 | 419 | /* Begin XCConfigurationList section */ 420 | 176F666C1B2E6CC90097A9B3 /* Build configuration list for PBXProject "Mockingbird" */ = { 421 | isa = XCConfigurationList; 422 | buildConfigurations = ( 423 | 176F668E1B2E6CC90097A9B3 /* Debug */, 424 | 176F668F1B2E6CC90097A9B3 /* Release */, 425 | ); 426 | defaultConfigurationIsVisible = 0; 427 | defaultConfigurationName = Release; 428 | }; 429 | 176F66901B2E6CC90097A9B3 /* Build configuration list for PBXNativeTarget "Mockingbird" */ = { 430 | isa = XCConfigurationList; 431 | buildConfigurations = ( 432 | 176F66911B2E6CC90097A9B3 /* Debug */, 433 | 176F66921B2E6CC90097A9B3 /* Release */, 434 | ); 435 | defaultConfigurationIsVisible = 0; 436 | defaultConfigurationName = Release; 437 | }; 438 | 176F66931B2E6CC90097A9B3 /* Build configuration list for PBXNativeTarget "MockingbirdTests" */ = { 439 | isa = XCConfigurationList; 440 | buildConfigurations = ( 441 | 176F66941B2E6CC90097A9B3 /* Debug */, 442 | 176F66951B2E6CC90097A9B3 /* Release */, 443 | ); 444 | defaultConfigurationIsVisible = 0; 445 | defaultConfigurationName = Release; 446 | }; 447 | /* End XCConfigurationList section */ 448 | }; 449 | rootObject = 176F66691B2E6CC90097A9B3 /* Project object */; 450 | } 451 | -------------------------------------------------------------------------------- /Mockingbird.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Mockingbird/Mockingbird.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /Mockingbird/Mockingbird.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Mockingbird.swift 3 | // Mockingbird 4 | // 5 | // Created by xiangwenwen on 15/6/16. 6 | // Copyright (c) 2015年 xiangwenwen. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | let MOKTeal:UIColor = UIColor(red: 0.000, green: 0.502, blue: 0.502, alpha: 1.000) 13 | let MOKOrchid:UIColor = UIColor(red: 0.400, green: 0.400, blue: 1.000, alpha: 1.000) 14 | let MOKCantaloupe:UIColor = UIColor(red: 1.000, green: 0.800, blue: 0.400, alpha: 1.000) 15 | let MOKSky:UIColor = UIColor(red: 0.400, green: 0.800, blue: 1.000, alpha: 1.000) 16 | let MOKLavender:UIColor = UIColor(red: 0.800, green: 0.400, blue: 1.000, alpha: 1.000) 17 | let MOKSnow:UIColor = UIColor.whiteColor() 18 | 19 | let MOKWidth:CGFloat = UIScreen.mainScreen().bounds.width 20 | let MOKHeight:CGFloat = UIScreen.mainScreen().bounds.height 21 | 22 | let MOKNotifiScanResult:String = "MockingbirdResult" -------------------------------------------------------------------------------- /Mockingbird/MockingbirdScanCodeManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MockingbirdScanCodeManager.swift 3 | // Mockingbird 4 | // 5 | // Created by xiangwenwen on 15/6/15. 6 | // Copyright (c) 2015年 xiangwenwen. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | import AVFoundation 12 | 13 | class MockingbirdScanCodeManager:UIViewController,AVCaptureMetadataOutputObjectsDelegate{ 14 | @IBOutlet weak var loadLine: UIActivityIndicatorView! 15 | 16 | var captureSession:AVCaptureSession? 17 | var globalColor:UIColor? 18 | var globalTitle:String? 19 | var previewLineColor:UIColor? 20 | 21 | var videoPreviewLayer:AVCaptureVideoPreviewLayer? 22 | var videoPreviewLineAnimationFrameView:UIView? 23 | var videoPreviewContainsFrameView:UIView? 24 | 25 | var mockingbirdResult:((value:String?)->Void)? 26 | 27 | private var isReading:Bool = false 28 | 29 | override func viewDidLoad() { 30 | super.viewDidLoad() 31 | self.navigationItem.title = self.globalTitle == nil ? "扫描条码" : self.globalTitle 32 | let reminder = UILabel(frame: CGRectMake(0, MOKHeight-80, MOKWidth, 40)) 33 | reminder.textAlignment = NSTextAlignment.Center 34 | reminder.textColor = MOKSnow 35 | reminder.text = "对准要扫描的条码" 36 | reminder.font = UIFont.systemFontOfSize(25.0) 37 | self.view.addSubview(reminder) 38 | self.view.bringSubviewToFront(reminder) 39 | self.handlerViewColor() 40 | // Do any additional setup after loading the view, typically from a nib. 41 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), { () -> Void in 42 | let captureDevice = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo) 43 | var error:NSError? 44 | let input:AnyObject! = AVCaptureDeviceInput.deviceInputWithDevice(captureDevice, error: &error) 45 | if error != nil{ 46 | println("\( error?.localizedDescription)") 47 | }else{ 48 | self.captureSession = AVCaptureSession() 49 | self.captureSession?.addInput(input as! AVCaptureInput) 50 | let captureMetadataOutput = AVCaptureMetadataOutput() 51 | self.captureSession?.addOutput(captureMetadataOutput) 52 | captureMetadataOutput.setMetadataObjectsDelegate(self, queue: dispatch_get_main_queue()) 53 | captureMetadataOutput.metadataObjectTypes = [AVMetadataObjectTypeEAN13Code,AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeCode128Code,AVMetadataObjectTypeQRCode] 54 | println("scan code init") 55 | } 56 | dispatch_async(dispatch_get_main_queue(), { () -> Void in 57 | self.loadLine.hidden = true 58 | self.videoPreviewLayer = AVCaptureVideoPreviewLayer(session: self.captureSession) 59 | self.videoPreviewLayer?.videoGravity = AVLayerVideoGravityResizeAspectFill 60 | self.videoPreviewLayer?.frame = self.view.bounds 61 | self.view.layer.addSublayer(self.videoPreviewLayer) 62 | self.createUIView() 63 | self.captureSession?.startRunning() 64 | reminder.removeFromSuperview() 65 | }) 66 | }) 67 | } 68 | 69 | func captureOutput(captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [AnyObject]!, fromConnection connection: AVCaptureConnection!) { 70 | if metadataObjects == nil || metadataObjects.count == 0{ 71 | self.videoPreviewContainsFrameView?.frame = CGRectZero 72 | println("No QR code is detected") 73 | return 74 | } 75 | self.dismissViewControllerAnimated(true, completion: nil) 76 | if !self.isReading{ 77 | self.isReading = true 78 | let metadata = metadataObjects[0] as! AVMetadataMachineReadableCodeObject 79 | let barCode = self.videoPreviewLayer?.transformedMetadataObjectForMetadataObject(metadata) as! AVMetadataMachineReadableCodeObject 80 | self.videoPreviewContainsFrameView?.frame = barCode.bounds 81 | if self.mockingbirdResult != nil{ 82 | self.mockingbirdResult?(value: metadata.stringValue) 83 | }else{ 84 | NSNotificationCenter.defaultCenter().postNotificationName(MOKNotifiScanResult, object: nil, userInfo: ["value":metadata.stringValue]) 85 | } 86 | } 87 | } 88 | 89 | private func createUIView()->Void{ 90 | self.videoPreviewContainsFrameView = UIView(frame: CGRectMake(MOKWidth/4, (MOKHeight-200)/2, MOKWidth/2, 200)) 91 | self.videoPreviewContainsFrameView?.layer.borderColor = self.globalColor == nil ? MOKOrchid.CGColor : self.globalColor!.CGColor 92 | self.videoPreviewContainsFrameView?.layer.borderWidth = 1 93 | self.view.addSubview(self.videoPreviewContainsFrameView!) 94 | self.view.bringSubviewToFront(self.videoPreviewContainsFrameView!) 95 | self.videoPreviewLineAnimationFrameView = UIView(frame: CGRectMake(0,0, MOKWidth/2, 1)) 96 | self.videoPreviewLineAnimationFrameView?.layer.borderWidth = 1 97 | self.videoPreviewLineAnimationFrameView?.layer.borderColor = self.previewLineColor == nil ? MOKSnow.CGColor : self.previewLineColor?.CGColor 98 | self.videoPreviewContainsFrameView?.addSubview(self.videoPreviewLineAnimationFrameView!) 99 | self.videoPreviewLineAnimation() 100 | var time:NSTimer = NSTimer.scheduledTimerWithTimeInterval(NSTimeInterval(2.0), target: self, selector: "repetitionScanAnimation", userInfo: nil, repeats: true) 101 | let reminder = UILabel(frame: CGRectMake(0, MOKHeight-80, MOKWidth, 40)) 102 | reminder.textAlignment = NSTextAlignment.Center 103 | reminder.textColor = MOKSnow 104 | reminder.text = "对准要扫描的条码" 105 | reminder.font = UIFont.systemFontOfSize(25.0) 106 | self.view.addSubview(reminder) 107 | self.view.bringSubviewToFront(reminder) 108 | } 109 | 110 | func videoPreviewLineAnimation()->Void{ 111 | let animation = CABasicAnimation(keyPath: "MOK") 112 | animation.duration = 2.0 113 | animation.keyPath = "position.y" 114 | animation.toValue = 200 115 | self.videoPreviewLineAnimationFrameView?.layer.addAnimation(animation, forKey: "MOK") 116 | } 117 | 118 | func repetitionScanAnimation()->Void{ 119 | self.videoPreviewLineAnimation() 120 | } 121 | 122 | private func handlerViewColor()->Void{ 123 | if let color = self.globalColor{ 124 | self.navigationController?.navigationBar.barTintColor = color 125 | self.loadLine.color = color 126 | } 127 | } 128 | 129 | @IBAction func cancel(sender: UIBarButtonItem) { 130 | self.dismissViewControllerAnimated(true, completion: nil) 131 | } 132 | override func didReceiveMemoryWarning() { 133 | super.didReceiveMemoryWarning() 134 | // Dispose of any resources that can be recreated. 135 | } 136 | 137 | } 138 | -------------------------------------------------------------------------------- /MockingbirdDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Mockingbird 4 | // 5 | // Created by xiangwenwen on 15/6/15. 6 | // Copyright (c) 2015年 xiangwenwen. 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: [NSObject: AnyObject]?) -> 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 throttle down OpenGL ES frame rates. 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 inactive 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 | -------------------------------------------------------------------------------- /MockingbirdDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /MockingbirdDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 28 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /MockingbirdDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-Small@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-Small@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "40x40", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-40@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "40x40", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-40@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "60x60", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-60@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-60@3x.png", 37 | "scale" : "3x" 38 | } 39 | ], 40 | "info" : { 41 | "version" : 1, 42 | "author" : "xcode" 43 | } 44 | } -------------------------------------------------------------------------------- /MockingbirdDemo/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightningminers/Mockingbird/9ab7e278ba8074d27e25a272301844d9271a1425/MockingbirdDemo/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png -------------------------------------------------------------------------------- /MockingbirdDemo/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightningminers/Mockingbird/9ab7e278ba8074d27e25a272301844d9271a1425/MockingbirdDemo/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png -------------------------------------------------------------------------------- /MockingbirdDemo/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightningminers/Mockingbird/9ab7e278ba8074d27e25a272301844d9271a1425/MockingbirdDemo/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /MockingbirdDemo/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightningminers/Mockingbird/9ab7e278ba8074d27e25a272301844d9271a1425/MockingbirdDemo/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /MockingbirdDemo/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightningminers/Mockingbird/9ab7e278ba8074d27e25a272301844d9271a1425/MockingbirdDemo/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png -------------------------------------------------------------------------------- /MockingbirdDemo/Images.xcassets/AppIcon.appiconset/Icon-Small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightningminers/Mockingbird/9ab7e278ba8074d27e25a272301844d9271a1425/MockingbirdDemo/Images.xcassets/AppIcon.appiconset/Icon-Small@3x.png -------------------------------------------------------------------------------- /MockingbirdDemo/Images.xcassets/CloseModalImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "iconfont-close.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "iconfont-close-1.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "iconfont-close@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /MockingbirdDemo/Images.xcassets/CloseModalImage.imageset/iconfont-close-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightningminers/Mockingbird/9ab7e278ba8074d27e25a272301844d9271a1425/MockingbirdDemo/Images.xcassets/CloseModalImage.imageset/iconfont-close-1.png -------------------------------------------------------------------------------- /MockingbirdDemo/Images.xcassets/CloseModalImage.imageset/iconfont-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightningminers/Mockingbird/9ab7e278ba8074d27e25a272301844d9271a1425/MockingbirdDemo/Images.xcassets/CloseModalImage.imageset/iconfont-close.png -------------------------------------------------------------------------------- /MockingbirdDemo/Images.xcassets/CloseModalImage.imageset/iconfont-close@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightningminers/Mockingbird/9ab7e278ba8074d27e25a272301844d9271a1425/MockingbirdDemo/Images.xcassets/CloseModalImage.imageset/iconfont-close@3x.png -------------------------------------------------------------------------------- /MockingbirdDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | wen.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /MockingbirdDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Mockingbird 4 | // 5 | // Created by xiangwenwen on 15/6/15. 6 | // Copyright (c) 2015年 xiangwenwen. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | @IBOutlet weak var scancode: UILabel! 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | // Do any additional setup after loading the view, typically from a nib. 17 | NSNotificationCenter.defaultCenter().addObserver(self, selector: "mockingbird:", name:MOKNotifiScanResult, object: nil) 18 | 19 | } 20 | 21 | func mockingbird(note:NSNotification)->Void{ 22 | if let userInfo:Dictionary = note.userInfo{ 23 | self.scancode.text = userInfo["value"] as? String 24 | } 25 | } 26 | 27 | override func didReceiveMemoryWarning() { 28 | super.didReceiveMemoryWarning() 29 | // Dispose of any resources that can be recreated. 30 | } 31 | 32 | @IBAction func scancodeinfo(sender: UIButton) { 33 | let storyboard:UIStoryboard = UIStoryboard(name: "Mockingbird", bundle: NSBundle.mainBundle()) 34 | let navC:UINavigationController = storyboard.instantiateViewControllerWithIdentifier("MockingbirdNavigationID") as! UINavigationController 35 | let mockingbird:MockingbirdScanCodeManager = navC.topViewController as! MockingbirdScanCodeManager 36 | mockingbird.globalTitle = "扫描条码" 37 | mockingbird.globalColor = MOKTeal 38 | mockingbird.mockingbirdResult = {(value:String?)->Void in 39 | println(value) 40 | println("回调函数") 41 | if let _value = value{ 42 | self.scancode.text = _value 43 | } 44 | } 45 | self.presentViewController(navC, animated: true, completion: nil) 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /MockingbirdTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | wen.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /MockingbirdTests/MockingbirdTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MockingbirdTests.swift 3 | // MockingbirdTests 4 | // 5 | // Created by xiangwenwen on 15/6/15. 6 | // Copyright (c) 2015年 xiangwenwen. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class MockingbirdTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Mockingbird 2 | 3 | >Tag v0.0.1 4 | 5 | ![](https://img.shields.io/jenkins/s/https/jenkins.qa.ubuntu.com/precise-desktop-amd64_default.svg) 6 | ![](https://img.shields.io/github/license/mashape/apistatus.svg) 7 | ![](https://camo.githubusercontent.com/770175f6c01d89c84a020706126a9e6399ff76c4/68747470733a2f2f696d672e736869656c64732e696f2f636f636f61706f64732f702f4b696e676669736865722e7376673f7374796c653d666c6174) 8 | 9 | ## Requirements 10 | 11 | * iOS 7.0+ 12 | * Xcode 6.3 13 | 14 | ## Use 15 | 16 | let storyboard:UIStoryboard = UIStoryboard(name: "Mockingbird", bundle: NSBundle.mainBundle()) 17 | let navC:UINavigationController = storyboard.instantiateViewControllerWithIdentifier("MockingbirdNavigationID") as! UINavigationController 18 | let mockingbird:MockingbirdScanCodeManager = navC.topViewController as! MockingbirdScanCodeManager 19 | mockingbird.globalTitle = "扫描条码" 20 | mockingbird.globalColor = MOKTeal 21 | self.presentViewController(navC, animated: true, completion: nil) 22 | 23 | ## property 24 | 25 | * globalColor:UIColor? 设置全局的颜色 26 | * globalTitle:String? 设置导航标题 27 | * previewLineColor:UIColor? 设置线动画的颜色 28 | 29 | ## Notification 30 | 31 | NSNotificationCenter.defaultCenter().addObserver(self, selector: "mockingbird:", name:MOKNotifiScanResult, object: nil) 32 | 33 | scan code result | 通过通知来获取扫描的结果 34 | 35 | ## OR Callback Func 36 | 37 | scan code result | 或者通过回调函数 38 | 39 | mockingbird.mockingbirdResult = {(value:String?)->Void in 40 | println(value) 41 | println("回调函数") 42 | if let _value = value{ 43 | self.scancode.text = _value 44 | } 45 | } 46 | 47 | ## how learning used AVFoundation to create scan code 48 | 49 | [how learning used AVFoundation to create scan code | 利用AVFoundation实现扫描条码](http://lcepy.github.io/2015/06/16/%E5%88%A9%E7%94%A8AVFoundation%E5%AE%9E%E7%8E%B0%E6%89%AB%E6%8F%8F%E6%9D%A1%E7%A0%81/) 50 | 51 | ## OC 52 | 53 | create bridging header file and set module Yes,then you import product name -Swift.h file 54 | 55 | UIStoryboard *stor = [UIStoryboard storyboardWithName:@"Mockingbird" bundle:[NSBundle mainBundle]]; 56 | UINavigationController *navc = [stor instantiateViewControllerWithIdentifier:@"MockingbirdNavigationID"]; 57 | MockingbirdScanCodeManager *mocking = (MockingbirdScanCodeManager *)navc.topViewController; 58 | mocking.mockingbirdResult = ^(NSString * __nonnull value){ 59 | self.showScanCodeInfo.text = value; 60 | }; 61 | [self presentViewController:navc animated:YES completion:nil]; 62 | 63 | ## License 64 | 65 | This code is distributed under the terms and conditions of the MIT license. 66 | -------------------------------------------------------------------------------- /animal-162020_640.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightningminers/Mockingbird/9ab7e278ba8074d27e25a272301844d9271a1425/animal-162020_640.png --------------------------------------------------------------------------------