├── Podfile ├── Podfile.lock ├── README.md ├── TextDetect.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── Xoriant.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── TextDetect.xcworkspace ├── contents.xcworkspacedata ├── xcshareddata │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── Xoriant.xcuserdatad │ └── xcdebugger │ └── Breakpoints_v2.xcbkptlist └── TextDetect ├── AppDelegate.swift ├── Assets.xcassets ├── AppIcon.appiconset │ └── Contents.json ├── Contents.json └── camera.imageset │ ├── Contents.json │ ├── icons8-screenshot-50.png │ ├── icons8-screenshot-51.png │ └── icons8-screenshot-52.png ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── Info.plist ├── TextDetect.xcdatamodeld ├── .xccurrentversion └── TextDetect.xcdatamodel │ └── contents └── ViewController.swift /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'TextDetect' do 5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 6 | use_frameworks! 7 | 8 | # Pods for TextDetect 9 | pod 'Firebase/Core', '~> 5.2.0' 10 | pod 'Firebase/MLVision', '~> 5.2.0' 11 | pod 'Firebase/MLVisionTextModel', '~> 5.2.0' 12 | end 13 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Firebase/Core (5.2.0): 3 | - Firebase/CoreOnly 4 | - FirebaseAnalytics (= 5.0.1) 5 | - Firebase/CoreOnly (5.2.0): 6 | - FirebaseCore (= 5.0.3) 7 | - Firebase/MLVision (5.2.0): 8 | - Firebase/CoreOnly 9 | - FirebaseMLVision (= 0.9.0) 10 | - Firebase/MLVisionTextModel (5.2.0): 11 | - Firebase/CoreOnly 12 | - FirebaseMLVisionTextModel (= 0.9.0) 13 | - FirebaseAnalytics (5.0.1): 14 | - FirebaseCore (~> 5.0) 15 | - FirebaseInstanceID (~> 3.0) 16 | - "GoogleToolboxForMac/NSData+zlib (~> 2.1)" 17 | - nanopb (~> 0.3) 18 | - FirebaseCore (5.0.3): 19 | - "GoogleToolboxForMac/NSData+zlib (~> 2.1)" 20 | - FirebaseInstanceID (3.1.0): 21 | - FirebaseCore (~> 5.0) 22 | - FirebaseMLCommon (0.9.0) 23 | - FirebaseMLVision (0.9.0): 24 | - FirebaseCore (~> 5.0) 25 | - FirebaseMLCommon (~> 0.9) 26 | - GoogleAPIClientForREST/Core (~> 1.3) 27 | - GoogleAPIClientForREST/Vision (~> 1.3) 28 | - GoogleMobileVision/Detector (~> 1.3.0) 29 | - FirebaseMLVisionTextModel (0.9.0): 30 | - GoogleMobileVision/TextDetector (~> 1.3.0) 31 | - GoogleAPIClientForREST/Core (1.3.4): 32 | - GTMSessionFetcher (>= 1.1.7) 33 | - GoogleAPIClientForREST/Vision (1.3.4): 34 | - GoogleAPIClientForREST/Core 35 | - GTMSessionFetcher (>= 1.1.7) 36 | - GoogleMobileVision/Detector (1.3.2): 37 | - GoogleToolboxForMac/Logger (~> 2.1) 38 | - "GoogleToolboxForMac/NSData+zlib (~> 2.1)" 39 | - GTMSessionFetcher/Core (~> 1.1) 40 | - Protobuf (~> 3.1) 41 | - GoogleMobileVision/TextDetector (1.3.2): 42 | - GoogleMobileVision/Detector (~> 1.3) 43 | - GoogleToolboxForMac/Defines (2.1.4) 44 | - GoogleToolboxForMac/Logger (2.1.4): 45 | - GoogleToolboxForMac/Defines (= 2.1.4) 46 | - "GoogleToolboxForMac/NSData+zlib (2.1.4)": 47 | - GoogleToolboxForMac/Defines (= 2.1.4) 48 | - GTMSessionFetcher (1.1.15): 49 | - GTMSessionFetcher/Full (= 1.1.15) 50 | - GTMSessionFetcher/Core (1.1.15) 51 | - GTMSessionFetcher/Full (1.1.15): 52 | - GTMSessionFetcher/Core (= 1.1.15) 53 | - nanopb (0.3.8): 54 | - nanopb/decode (= 0.3.8) 55 | - nanopb/encode (= 0.3.8) 56 | - nanopb/decode (0.3.8) 57 | - nanopb/encode (0.3.8) 58 | - Protobuf (3.6.0) 59 | 60 | DEPENDENCIES: 61 | - Firebase/Core 62 | - Firebase/MLVision 63 | - Firebase/MLVisionTextModel 64 | 65 | SPEC REPOS: 66 | https://github.com/cocoapods/specs.git: 67 | - Firebase 68 | - FirebaseAnalytics 69 | - FirebaseCore 70 | - FirebaseInstanceID 71 | - FirebaseMLCommon 72 | - FirebaseMLVision 73 | - FirebaseMLVisionTextModel 74 | - GoogleAPIClientForREST 75 | - GoogleMobileVision 76 | - GoogleToolboxForMac 77 | - GTMSessionFetcher 78 | - nanopb 79 | - Protobuf 80 | 81 | SPEC CHECKSUMS: 82 | Firebase: 25ed0412036d7d008568d1fb4d2e9d81ea8a0a2c 83 | FirebaseAnalytics: b3628aea54c50464c32c393fb2ea032566e7ecc2 84 | FirebaseCore: a3c87242451633fff8490183898075ce77d168d2 85 | FirebaseInstanceID: 05d779cbb97bd5bd5c51a38a903fc9cfe1b2454a 86 | FirebaseMLCommon: 73a2f53c8b3e6cd18e73dd1be095c3192af26a5e 87 | FirebaseMLVision: f9756d8376dd150fb17629eaa7bdc6baa8965677 88 | FirebaseMLVisionTextModel: 8a9cb61296d4d15d60eb0c7c66a2a88790b34376 89 | GoogleAPIClientForREST: f7951c455df271bc6259b3ddb4073d0026475ccf 90 | GoogleMobileVision: 6b0a3a2dae1974ec35d80fdeeacc3a03193642e0 91 | GoogleToolboxForMac: 91c824d21e85b31c2aae9bb011c5027c9b4e738f 92 | GTMSessionFetcher: 5fa5b80fd20e439ef5f545fb2cb3ca6c6714caa2 93 | nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3 94 | Protobuf: 0fc0ad8bec688b2a3017a139953e01374fedbd5f 95 | 96 | PODFILE CHECKSUM: cd0e1c5da4f7265fe6cdd759cb90cb97d6e71077 97 | 98 | COCOAPODS: 1.5.2 99 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TextDetect 2 | This app detects the text from a picture input using camera or photos gallery of the iPhone/Simulator. The app uses on device Text Recognition in iOS using MLKit in Firebase by Google. 3 |

4 | Before you run the project, open terminal and go to the root folder of the project and type:
5 | $ pod install
6 | This will install the following required pods:
7 | 'Firebase/Core', '\~> 5.2.0' 8 |
9 | 'Firebase/MLVision', '\~> 5.2.0' 10 |
11 | 'Firebase/MLVisionTextModel', '~> 5.2.0' 12 |

13 | If cocoapods is not already installed, install it with following gem command.
14 | $ sudo gem install cocoapods
15 |
16 | You would also need to add GoogleService-Info.plist file to your project for firebase integration in order to use MLKit. 17 | Refer these easy steps for the same. You will have to login to your gmail account for accessing the console to firebase. 18 |
19 |
20 | ![textdetect](https://user-images.githubusercontent.com/14230368/41650378-89a77834-749b-11e8-8d25-a72a2eb4b157.gif) 21 | -------------------------------------------------------------------------------- /TextDetect.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 48D3545A20D111F100436998 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48D3545920D111F100436998 /* AppDelegate.swift */; }; 11 | 48D3545C20D111F100436998 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48D3545B20D111F100436998 /* ViewController.swift */; }; 12 | 48D3545F20D111F100436998 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 48D3545D20D111F100436998 /* Main.storyboard */; }; 13 | 48D3546220D111F100436998 /* TextDetect.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 48D3546020D111F100436998 /* TextDetect.xcdatamodeld */; }; 14 | 48D3546420D111F800436998 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 48D3546320D111F800436998 /* Assets.xcassets */; }; 15 | 48D3546720D111F800436998 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 48D3546520D111F800436998 /* LaunchScreen.storyboard */; }; 16 | 48D3546F20D1143000436998 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 48D3546E20D1143000436998 /* GoogleService-Info.plist */; }; 17 | DBAFECCA48C6AC92ED3C25D3 /* Pods_TextDetect.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 85F9C3BAF0E08F303695B9A4 /* Pods_TextDetect.framework */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 48D3545620D111F100436998 /* TextDetect.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TextDetect.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | 48D3545920D111F100436998 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 23 | 48D3545B20D111F100436998 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 24 | 48D3545E20D111F100436998 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | 48D3546120D111F100436998 /* TextDetect.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = TextDetect.xcdatamodel; sourceTree = ""; }; 26 | 48D3546320D111F800436998 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 27 | 48D3546620D111F800436998 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 28 | 48D3546820D111F800436998 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | 48D3546E20D1143000436998 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../Downloads/GoogleService-Info.plist"; sourceTree = ""; }; 30 | 632043D7B63C88E5BA0ED229 /* Pods-TextDetect.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TextDetect.debug.xcconfig"; path = "Pods/Target Support Files/Pods-TextDetect/Pods-TextDetect.debug.xcconfig"; sourceTree = ""; }; 31 | 85F9C3BAF0E08F303695B9A4 /* Pods_TextDetect.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_TextDetect.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | F5A5F2E5604595527F8454C3 /* Pods-TextDetect.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TextDetect.release.xcconfig"; path = "Pods/Target Support Files/Pods-TextDetect/Pods-TextDetect.release.xcconfig"; sourceTree = ""; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | 48D3545320D111F100436998 /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | DBAFECCA48C6AC92ED3C25D3 /* Pods_TextDetect.framework in Frameworks */, 41 | ); 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | /* End PBXFrameworksBuildPhase section */ 45 | 46 | /* Begin PBXGroup section */ 47 | 1FE60AE345C21E9CAFC7C2E4 /* Pods */ = { 48 | isa = PBXGroup; 49 | children = ( 50 | 632043D7B63C88E5BA0ED229 /* Pods-TextDetect.debug.xcconfig */, 51 | F5A5F2E5604595527F8454C3 /* Pods-TextDetect.release.xcconfig */, 52 | ); 53 | name = Pods; 54 | sourceTree = ""; 55 | }; 56 | 48D3544D20D111F100436998 = { 57 | isa = PBXGroup; 58 | children = ( 59 | 48D3545820D111F100436998 /* TextDetect */, 60 | 48D3545720D111F100436998 /* Products */, 61 | 1FE60AE345C21E9CAFC7C2E4 /* Pods */, 62 | C18176343B9650701FE632B0 /* Frameworks */, 63 | ); 64 | sourceTree = ""; 65 | }; 66 | 48D3545720D111F100436998 /* Products */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 48D3545620D111F100436998 /* TextDetect.app */, 70 | ); 71 | name = Products; 72 | sourceTree = ""; 73 | }; 74 | 48D3545820D111F100436998 /* TextDetect */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 48D3545920D111F100436998 /* AppDelegate.swift */, 78 | 48D3545B20D111F100436998 /* ViewController.swift */, 79 | 48D3545D20D111F100436998 /* Main.storyboard */, 80 | 48D3546320D111F800436998 /* Assets.xcassets */, 81 | 48D3546520D111F800436998 /* LaunchScreen.storyboard */, 82 | 48D3546820D111F800436998 /* Info.plist */, 83 | 48D3546E20D1143000436998 /* GoogleService-Info.plist */, 84 | 48D3546020D111F100436998 /* TextDetect.xcdatamodeld */, 85 | ); 86 | path = TextDetect; 87 | sourceTree = ""; 88 | }; 89 | C18176343B9650701FE632B0 /* Frameworks */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 85F9C3BAF0E08F303695B9A4 /* Pods_TextDetect.framework */, 93 | ); 94 | name = Frameworks; 95 | sourceTree = ""; 96 | }; 97 | /* End PBXGroup section */ 98 | 99 | /* Begin PBXNativeTarget section */ 100 | 48D3545520D111F100436998 /* TextDetect */ = { 101 | isa = PBXNativeTarget; 102 | buildConfigurationList = 48D3546B20D111F800436998 /* Build configuration list for PBXNativeTarget "TextDetect" */; 103 | buildPhases = ( 104 | 70CAABF895D9E7F2AA69ABD2 /* [CP] Check Pods Manifest.lock */, 105 | 48D3545220D111F100436998 /* Sources */, 106 | 48D3545320D111F100436998 /* Frameworks */, 107 | 48D3545420D111F100436998 /* Resources */, 108 | 4141F0FF9C12592E2CC51708 /* [CP] Embed Pods Frameworks */, 109 | 3846B554DAE96DFFB997E5F6 /* [CP] Copy Pods Resources */, 110 | ); 111 | buildRules = ( 112 | ); 113 | dependencies = ( 114 | ); 115 | name = TextDetect; 116 | productName = TextDetect; 117 | productReference = 48D3545620D111F100436998 /* TextDetect.app */; 118 | productType = "com.apple.product-type.application"; 119 | }; 120 | /* End PBXNativeTarget section */ 121 | 122 | /* Begin PBXProject section */ 123 | 48D3544E20D111F100436998 /* Project object */ = { 124 | isa = PBXProject; 125 | attributes = { 126 | LastSwiftUpdateCheck = 0940; 127 | LastUpgradeCheck = 0940; 128 | ORGANIZATIONNAME = Assignment; 129 | TargetAttributes = { 130 | 48D3545520D111F100436998 = { 131 | CreatedOnToolsVersion = 9.4; 132 | }; 133 | }; 134 | }; 135 | buildConfigurationList = 48D3545120D111F100436998 /* Build configuration list for PBXProject "TextDetect" */; 136 | compatibilityVersion = "Xcode 9.3"; 137 | developmentRegion = en; 138 | hasScannedForEncodings = 0; 139 | knownRegions = ( 140 | en, 141 | Base, 142 | ); 143 | mainGroup = 48D3544D20D111F100436998; 144 | productRefGroup = 48D3545720D111F100436998 /* Products */; 145 | projectDirPath = ""; 146 | projectRoot = ""; 147 | targets = ( 148 | 48D3545520D111F100436998 /* TextDetect */, 149 | ); 150 | }; 151 | /* End PBXProject section */ 152 | 153 | /* Begin PBXResourcesBuildPhase section */ 154 | 48D3545420D111F100436998 /* Resources */ = { 155 | isa = PBXResourcesBuildPhase; 156 | buildActionMask = 2147483647; 157 | files = ( 158 | 48D3546720D111F800436998 /* LaunchScreen.storyboard in Resources */, 159 | 48D3546F20D1143000436998 /* GoogleService-Info.plist in Resources */, 160 | 48D3546420D111F800436998 /* Assets.xcassets in Resources */, 161 | 48D3545F20D111F100436998 /* Main.storyboard in Resources */, 162 | ); 163 | runOnlyForDeploymentPostprocessing = 0; 164 | }; 165 | /* End PBXResourcesBuildPhase section */ 166 | 167 | /* Begin PBXShellScriptBuildPhase section */ 168 | 3846B554DAE96DFFB997E5F6 /* [CP] Copy Pods Resources */ = { 169 | isa = PBXShellScriptBuildPhase; 170 | buildActionMask = 2147483647; 171 | files = ( 172 | ); 173 | inputPaths = ( 174 | "${SRCROOT}/Pods/Target Support Files/Pods-TextDetect/Pods-TextDetect-resources.sh", 175 | "${PODS_CONFIGURATION_BUILD_DIR}/GoogleMobileVision/GoogleMVTextDetectorResources.bundle", 176 | ); 177 | name = "[CP] Copy Pods Resources"; 178 | outputPaths = ( 179 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleMVTextDetectorResources.bundle", 180 | ); 181 | runOnlyForDeploymentPostprocessing = 0; 182 | shellPath = /bin/sh; 183 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-TextDetect/Pods-TextDetect-resources.sh\"\n"; 184 | showEnvVarsInLog = 0; 185 | }; 186 | 4141F0FF9C12592E2CC51708 /* [CP] Embed Pods Frameworks */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | "${SRCROOT}/Pods/Target Support Files/Pods-TextDetect/Pods-TextDetect-frameworks.sh", 193 | "${BUILT_PRODUCTS_DIR}/GTMSessionFetcher/GTMSessionFetcher.framework", 194 | "${BUILT_PRODUCTS_DIR}/GoogleAPIClientForREST/GoogleAPIClientForREST.framework", 195 | "${BUILT_PRODUCTS_DIR}/GoogleToolboxForMac/GoogleToolboxForMac.framework", 196 | "${BUILT_PRODUCTS_DIR}/Protobuf/Protobuf.framework", 197 | "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", 198 | ); 199 | name = "[CP] Embed Pods Frameworks"; 200 | outputPaths = ( 201 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMSessionFetcher.framework", 202 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleAPIClientForREST.framework", 203 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleToolboxForMac.framework", 204 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework", 205 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | shellPath = /bin/sh; 209 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-TextDetect/Pods-TextDetect-frameworks.sh\"\n"; 210 | showEnvVarsInLog = 0; 211 | }; 212 | 70CAABF895D9E7F2AA69ABD2 /* [CP] Check Pods Manifest.lock */ = { 213 | isa = PBXShellScriptBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | ); 217 | inputPaths = ( 218 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 219 | "${PODS_ROOT}/Manifest.lock", 220 | ); 221 | name = "[CP] Check Pods Manifest.lock"; 222 | outputPaths = ( 223 | "$(DERIVED_FILE_DIR)/Pods-TextDetect-checkManifestLockResult.txt", 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | shellPath = /bin/sh; 227 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 228 | showEnvVarsInLog = 0; 229 | }; 230 | /* End PBXShellScriptBuildPhase section */ 231 | 232 | /* Begin PBXSourcesBuildPhase section */ 233 | 48D3545220D111F100436998 /* Sources */ = { 234 | isa = PBXSourcesBuildPhase; 235 | buildActionMask = 2147483647; 236 | files = ( 237 | 48D3545C20D111F100436998 /* ViewController.swift in Sources */, 238 | 48D3546220D111F100436998 /* TextDetect.xcdatamodeld in Sources */, 239 | 48D3545A20D111F100436998 /* AppDelegate.swift in Sources */, 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | }; 243 | /* End PBXSourcesBuildPhase section */ 244 | 245 | /* Begin PBXVariantGroup section */ 246 | 48D3545D20D111F100436998 /* Main.storyboard */ = { 247 | isa = PBXVariantGroup; 248 | children = ( 249 | 48D3545E20D111F100436998 /* Base */, 250 | ); 251 | name = Main.storyboard; 252 | sourceTree = ""; 253 | }; 254 | 48D3546520D111F800436998 /* LaunchScreen.storyboard */ = { 255 | isa = PBXVariantGroup; 256 | children = ( 257 | 48D3546620D111F800436998 /* Base */, 258 | ); 259 | name = LaunchScreen.storyboard; 260 | sourceTree = ""; 261 | }; 262 | /* End PBXVariantGroup section */ 263 | 264 | /* Begin XCBuildConfiguration section */ 265 | 48D3546920D111F800436998 /* Debug */ = { 266 | isa = XCBuildConfiguration; 267 | buildSettings = { 268 | ALWAYS_SEARCH_USER_PATHS = NO; 269 | CLANG_ANALYZER_NONNULL = YES; 270 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 271 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 272 | CLANG_CXX_LIBRARY = "libc++"; 273 | CLANG_ENABLE_MODULES = YES; 274 | CLANG_ENABLE_OBJC_ARC = YES; 275 | CLANG_ENABLE_OBJC_WEAK = YES; 276 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 277 | CLANG_WARN_BOOL_CONVERSION = YES; 278 | CLANG_WARN_COMMA = YES; 279 | CLANG_WARN_CONSTANT_CONVERSION = YES; 280 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 281 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 282 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 283 | CLANG_WARN_EMPTY_BODY = YES; 284 | CLANG_WARN_ENUM_CONVERSION = YES; 285 | CLANG_WARN_INFINITE_RECURSION = YES; 286 | CLANG_WARN_INT_CONVERSION = YES; 287 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 288 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 289 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 290 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 291 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 292 | CLANG_WARN_STRICT_PROTOTYPES = YES; 293 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 294 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 295 | CLANG_WARN_UNREACHABLE_CODE = YES; 296 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 297 | CODE_SIGN_IDENTITY = "iPhone Developer"; 298 | COPY_PHASE_STRIP = NO; 299 | DEBUG_INFORMATION_FORMAT = dwarf; 300 | ENABLE_STRICT_OBJC_MSGSEND = YES; 301 | ENABLE_TESTABILITY = YES; 302 | GCC_C_LANGUAGE_STANDARD = gnu11; 303 | GCC_DYNAMIC_NO_PIC = NO; 304 | GCC_NO_COMMON_BLOCKS = YES; 305 | GCC_OPTIMIZATION_LEVEL = 0; 306 | GCC_PREPROCESSOR_DEFINITIONS = ( 307 | "DEBUG=1", 308 | "$(inherited)", 309 | ); 310 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 311 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 312 | GCC_WARN_UNDECLARED_SELECTOR = YES; 313 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 314 | GCC_WARN_UNUSED_FUNCTION = YES; 315 | GCC_WARN_UNUSED_VARIABLE = YES; 316 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 317 | MTL_ENABLE_DEBUG_INFO = YES; 318 | ONLY_ACTIVE_ARCH = YES; 319 | SDKROOT = iphoneos; 320 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 321 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 322 | }; 323 | name = Debug; 324 | }; 325 | 48D3546A20D111F800436998 /* Release */ = { 326 | isa = XCBuildConfiguration; 327 | buildSettings = { 328 | ALWAYS_SEARCH_USER_PATHS = NO; 329 | CLANG_ANALYZER_NONNULL = YES; 330 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 331 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 332 | CLANG_CXX_LIBRARY = "libc++"; 333 | CLANG_ENABLE_MODULES = YES; 334 | CLANG_ENABLE_OBJC_ARC = YES; 335 | CLANG_ENABLE_OBJC_WEAK = YES; 336 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 337 | CLANG_WARN_BOOL_CONVERSION = YES; 338 | CLANG_WARN_COMMA = YES; 339 | CLANG_WARN_CONSTANT_CONVERSION = YES; 340 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 341 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 342 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 343 | CLANG_WARN_EMPTY_BODY = YES; 344 | CLANG_WARN_ENUM_CONVERSION = YES; 345 | CLANG_WARN_INFINITE_RECURSION = YES; 346 | CLANG_WARN_INT_CONVERSION = YES; 347 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 348 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 349 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 350 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 351 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 352 | CLANG_WARN_STRICT_PROTOTYPES = YES; 353 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 354 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 355 | CLANG_WARN_UNREACHABLE_CODE = YES; 356 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 357 | CODE_SIGN_IDENTITY = "iPhone Developer"; 358 | COPY_PHASE_STRIP = NO; 359 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 360 | ENABLE_NS_ASSERTIONS = NO; 361 | ENABLE_STRICT_OBJC_MSGSEND = YES; 362 | GCC_C_LANGUAGE_STANDARD = gnu11; 363 | GCC_NO_COMMON_BLOCKS = YES; 364 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 365 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 366 | GCC_WARN_UNDECLARED_SELECTOR = YES; 367 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 368 | GCC_WARN_UNUSED_FUNCTION = YES; 369 | GCC_WARN_UNUSED_VARIABLE = YES; 370 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 371 | MTL_ENABLE_DEBUG_INFO = NO; 372 | SDKROOT = iphoneos; 373 | SWIFT_COMPILATION_MODE = wholemodule; 374 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 375 | VALIDATE_PRODUCT = YES; 376 | }; 377 | name = Release; 378 | }; 379 | 48D3546C20D111F800436998 /* Debug */ = { 380 | isa = XCBuildConfiguration; 381 | baseConfigurationReference = 632043D7B63C88E5BA0ED229 /* Pods-TextDetect.debug.xcconfig */; 382 | buildSettings = { 383 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 384 | CODE_SIGN_STYLE = Automatic; 385 | INFOPLIST_FILE = TextDetect/Info.plist; 386 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 387 | LD_RUNPATH_SEARCH_PATHS = ( 388 | "$(inherited)", 389 | "@executable_path/Frameworks", 390 | ); 391 | PRODUCT_BUNDLE_IDENTIFIER = com.assignment.app.TextDetect; 392 | PRODUCT_NAME = "$(TARGET_NAME)"; 393 | SWIFT_VERSION = 4.0; 394 | TARGETED_DEVICE_FAMILY = "1,2"; 395 | }; 396 | name = Debug; 397 | }; 398 | 48D3546D20D111F800436998 /* Release */ = { 399 | isa = XCBuildConfiguration; 400 | baseConfigurationReference = F5A5F2E5604595527F8454C3 /* Pods-TextDetect.release.xcconfig */; 401 | buildSettings = { 402 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 403 | CODE_SIGN_STYLE = Automatic; 404 | INFOPLIST_FILE = TextDetect/Info.plist; 405 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 406 | LD_RUNPATH_SEARCH_PATHS = ( 407 | "$(inherited)", 408 | "@executable_path/Frameworks", 409 | ); 410 | PRODUCT_BUNDLE_IDENTIFIER = com.assignment.app.TextDetect; 411 | PRODUCT_NAME = "$(TARGET_NAME)"; 412 | SWIFT_VERSION = 4.0; 413 | TARGETED_DEVICE_FAMILY = "1,2"; 414 | }; 415 | name = Release; 416 | }; 417 | /* End XCBuildConfiguration section */ 418 | 419 | /* Begin XCConfigurationList section */ 420 | 48D3545120D111F100436998 /* Build configuration list for PBXProject "TextDetect" */ = { 421 | isa = XCConfigurationList; 422 | buildConfigurations = ( 423 | 48D3546920D111F800436998 /* Debug */, 424 | 48D3546A20D111F800436998 /* Release */, 425 | ); 426 | defaultConfigurationIsVisible = 0; 427 | defaultConfigurationName = Release; 428 | }; 429 | 48D3546B20D111F800436998 /* Build configuration list for PBXNativeTarget "TextDetect" */ = { 430 | isa = XCConfigurationList; 431 | buildConfigurations = ( 432 | 48D3546C20D111F800436998 /* Debug */, 433 | 48D3546D20D111F800436998 /* Release */, 434 | ); 435 | defaultConfigurationIsVisible = 0; 436 | defaultConfigurationName = Release; 437 | }; 438 | /* End XCConfigurationList section */ 439 | 440 | /* Begin XCVersionGroup section */ 441 | 48D3546020D111F100436998 /* TextDetect.xcdatamodeld */ = { 442 | isa = XCVersionGroup; 443 | children = ( 444 | 48D3546120D111F100436998 /* TextDetect.xcdatamodel */, 445 | ); 446 | currentVersion = 48D3546120D111F100436998 /* TextDetect.xcdatamodel */; 447 | path = TextDetect.xcdatamodeld; 448 | sourceTree = ""; 449 | versionGroupType = wrapper.xcdatamodel; 450 | }; 451 | /* End XCVersionGroup section */ 452 | }; 453 | rootObject = 48D3544E20D111F100436998 /* Project object */; 454 | } 455 | -------------------------------------------------------------------------------- /TextDetect.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TextDetect.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TextDetect.xcodeproj/xcuserdata/Xoriant.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | TextDetect.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /TextDetect.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /TextDetect.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TextDetect.xcworkspace/xcuserdata/Xoriant.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /TextDetect/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // TextDetect 4 | // 5 | // Created by Sayalee on 6/13/18. 6 | // Copyright © 2018 Assignment. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CoreData 11 | import Firebase 12 | 13 | @UIApplicationMain 14 | class AppDelegate: UIResponder, UIApplicationDelegate { 15 | 16 | var window: UIWindow? 17 | 18 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 19 | // Override point for customization after application launch. 20 | FirebaseApp.configure() 21 | return true 22 | } 23 | 24 | func applicationWillResignActive(_ application: UIApplication) { 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 | func applicationDidEnterBackground(_ application: UIApplication) { 30 | // 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. 31 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 32 | } 33 | 34 | func applicationWillEnterForeground(_ application: UIApplication) { 35 | // 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. 36 | } 37 | 38 | func applicationDidBecomeActive(_ application: UIApplication) { 39 | // 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. 40 | } 41 | 42 | func applicationWillTerminate(_ application: UIApplication) { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | // Saves changes in the application's managed object context before the application terminates. 45 | self.saveContext() 46 | } 47 | 48 | // MARK: - Core Data stack 49 | 50 | lazy var persistentContainer: NSPersistentContainer = { 51 | /* 52 | The persistent container for the application. This implementation 53 | creates and returns a container, having loaded the store for the 54 | application to it. This property is optional since there are legitimate 55 | error conditions that could cause the creation of the store to fail. 56 | */ 57 | let container = NSPersistentContainer(name: "TextDetect") 58 | container.loadPersistentStores(completionHandler: { (storeDescription, error) in 59 | if let error = error as NSError? { 60 | // Replace this implementation with code to handle the error appropriately. 61 | // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 62 | 63 | /* 64 | Typical reasons for an error here include: 65 | * The parent directory does not exist, cannot be created, or disallows writing. 66 | * The persistent store is not accessible, due to permissions or data protection when the device is locked. 67 | * The device is out of space. 68 | * The store could not be migrated to the current model version. 69 | Check the error message to determine what the actual problem was. 70 | */ 71 | fatalError("Unresolved error \(error), \(error.userInfo)") 72 | } 73 | }) 74 | return container 75 | }() 76 | 77 | // MARK: - Core Data Saving support 78 | 79 | func saveContext () { 80 | let context = persistentContainer.viewContext 81 | if context.hasChanges { 82 | do { 83 | try context.save() 84 | } catch { 85 | // Replace this implementation with code to handle the error appropriately. 86 | // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 87 | let nserror = error as NSError 88 | fatalError("Unresolved error \(nserror), \(nserror.userInfo)") 89 | } 90 | } 91 | } 92 | 93 | } 94 | 95 | -------------------------------------------------------------------------------- /TextDetect/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 | } -------------------------------------------------------------------------------- /TextDetect/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /TextDetect/Assets.xcassets/camera.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "icons8-screenshot-50.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "icons8-screenshot-51.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "icons8-screenshot-52.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /TextDetect/Assets.xcassets/camera.imageset/icons8-screenshot-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sayaleepote/TextDetect/7b90ae984e6dd3ba1d31f40a0474ca2beeae1a81/TextDetect/Assets.xcassets/camera.imageset/icons8-screenshot-50.png -------------------------------------------------------------------------------- /TextDetect/Assets.xcassets/camera.imageset/icons8-screenshot-51.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sayaleepote/TextDetect/7b90ae984e6dd3ba1d31f40a0474ca2beeae1a81/TextDetect/Assets.xcassets/camera.imageset/icons8-screenshot-51.png -------------------------------------------------------------------------------- /TextDetect/Assets.xcassets/camera.imageset/icons8-screenshot-52.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sayaleepote/TextDetect/7b90ae984e6dd3ba1d31f40a0474ca2beeae1a81/TextDetect/Assets.xcassets/camera.imageset/icons8-screenshot-52.png -------------------------------------------------------------------------------- /TextDetect/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 | -------------------------------------------------------------------------------- /TextDetect/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 31 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /TextDetect/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 | NSCameraUsageDescription 24 | The app would need to access your camera/photos for predictions. 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 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /TextDetect/TextDetect.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | TextDetect.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /TextDetect/TextDetect.xcdatamodeld/TextDetect.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /TextDetect/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // TextDetect 4 | // 5 | // Created by Sayalee on 6/13/18. 6 | // Copyright © 2018 Assignment. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Firebase 11 | 12 | class ViewController: UIViewController, UINavigationControllerDelegate { 13 | 14 | @IBOutlet weak var detectedText: UILabel! 15 | @IBOutlet weak var imageView: UIImageView! 16 | 17 | lazy var vision = Vision.vision() 18 | var textDetector: VisionTextDetector? 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | } 23 | 24 | override func didReceiveMemoryWarning() { 25 | super.didReceiveMemoryWarning() 26 | } 27 | } 28 | 29 | // MARK: - UIImagePickerControllerDelegate 30 | 31 | extension ViewController: UIImagePickerControllerDelegate { 32 | func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { 33 | 34 | dismiss(animated: true, completion: nil) 35 | 36 | guard let image = info[UIImagePickerControllerOriginalImage] as? UIImage else { 37 | fatalError("couldn't load image") 38 | } 39 | imageView.image = image 40 | 41 | detectText(image: image) 42 | } 43 | } 44 | 45 | // MARK: - IBActions 46 | 47 | extension ViewController { 48 | 49 | @IBAction func cameraButtonTapped(_ sender: Any) { 50 | guard UIImagePickerController.isSourceTypeAvailable(.camera) else { 51 | let alert = UIAlertController(title: "No camera", message: "This device does not support camera.", preferredStyle: .alert) 52 | let ok = UIAlertAction(title: "OK", style: .cancel, handler: nil) 53 | alert.addAction(ok) 54 | self.present(alert, animated: true, completion: nil) 55 | return 56 | } 57 | 58 | let picker = UIImagePickerController() 59 | picker.delegate = self 60 | picker.sourceType = .camera 61 | picker.cameraCaptureMode = .photo 62 | self.present(picker, animated: true, completion: nil) 63 | } 64 | 65 | @IBAction func photosButtonTapped(_ sender: Any) { 66 | guard UIImagePickerController.isSourceTypeAvailable(.photoLibrary) else { 67 | let alert = UIAlertController(title: "No photos", message: "This device does not support photos.", preferredStyle: .alert) 68 | let ok = UIAlertAction(title: "OK", style: .cancel, handler: nil) 69 | alert.addAction(ok) 70 | self.present(alert, animated: true, completion: nil) 71 | return 72 | } 73 | 74 | let picker = UIImagePickerController() 75 | picker.delegate = self 76 | picker.sourceType = .photoLibrary 77 | self.present(picker, animated: true, completion: nil) 78 | } 79 | } 80 | 81 | // MARK: - Methods 82 | 83 | extension ViewController { 84 | func detectText (image: UIImage) { 85 | 86 | textDetector = vision.textDetector() 87 | 88 | let visionImage = VisionImage(image: image) 89 | 90 | textDetector?.detect(in: visionImage) { (features, error) in 91 | guard error == nil, let features = features, !features.isEmpty else { 92 | return 93 | } 94 | 95 | debugPrint("Feature blocks in th image: \(features.count)") 96 | 97 | var detectedText = "" 98 | for feature in features { 99 | let value = feature.text 100 | detectedText.append("\(value) ") 101 | } 102 | 103 | debugPrint(detectedText) 104 | self.detectedText.text = detectedText 105 | 106 | } 107 | } 108 | } 109 | 110 | 111 | --------------------------------------------------------------------------------