Skip to content

Commit c20c332

Browse files
committed
Cloud API fixes
1 parent 66650f2 commit c20c332

File tree

4 files changed

+26
-132
lines changed

4 files changed

+26
-132
lines changed

mlkit-ios/text-recognition/final/text-recognition/Podfile.lock

Lines changed: 0 additions & 82 deletions
This file was deleted.

mlkit-ios/text-recognition/final/text-recognition/text-recognition.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
BB70D4E3209CF98500743DA7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BB70D4E1209CF98500743DA7 /* Main.storyboard */; };
1414
BB70D4E5209CF98500743DA7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BB70D4E4209CF98500743DA7 /* Assets.xcassets */; };
1515
BB70D4E8209CF98500743DA7 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BB70D4E6209CF98500743DA7 /* LaunchScreen.storyboard */; };
16-
BBAAAE9920A210F500FA85D0 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = BBAAAE9820A210F500FA85D0 /* GoogleService-Info.plist */; };
16+
BBAAAE9F20A239F400FA85D0 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = BBAAAE9E20A239F400FA85D0 /* GoogleService-Info.plist */; };
1717
/* End PBXBuildFile section */
1818

1919
/* Begin PBXFileReference section */
@@ -27,7 +27,7 @@
2727
BB70D4E4209CF98500743DA7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
2828
BB70D4E7209CF98500743DA7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
2929
BB70D4E9209CF98500743DA7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
30-
BBAAAE9820A210F500FA85D0 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; };
30+
BBAAAE9E20A239F400FA85D0 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; };
3131
/* End PBXFileReference section */
3232

3333
/* Begin PBXFrameworksBuildPhase section */
@@ -84,7 +84,7 @@
8484
BB70D4DF209CF98500743DA7 /* ViewController.swift */,
8585
BB70D4F1209D000A00743DA7 /* Supporting Files */,
8686
BB70D4E9209CF98500743DA7 /* Info.plist */,
87-
BBAAAE9820A210F500FA85D0 /* GoogleService-Info.plist */,
87+
BBAAAE9E20A239F400FA85D0 /* GoogleService-Info.plist */,
8888
);
8989
path = "text-recognition";
9090
sourceTree = "";
@@ -162,7 +162,7 @@
162162
buildActionMask = 2147483647;
163163
files = (
164164
BB70D4E8209CF98500743DA7 /* LaunchScreen.storyboard in Resources */,
165-
BBAAAE9920A210F500FA85D0 /* GoogleService-Info.plist in Resources */,
165+
BBAAAE9F20A239F400FA85D0 /* GoogleService-Info.plist in Resources */,
166166
BB70D4E5209CF98500743DA7 /* Assets.xcassets in Resources */,
167167
BB70D4E3209CF98500743DA7 /* Main.storyboard in Resources */,
168168
);
@@ -383,7 +383,7 @@
383383
DEVELOPMENT_TEAM = EQHXZ8M8AV;
384384
INFOPLIST_FILE = "text-recognition/Info.plist";
385385
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
386-
PRODUCT_BUNDLE_IDENTIFIER = com.google.firebase.codelab.mlkit;
386+
PRODUCT_BUNDLE_IDENTIFIER = com.google.firebaseml.sampleapp;
387387
PRODUCT_NAME = "$(TARGET_NAME)";
388388
PROVISIONING_PROFILE = "dac40987-e637-434d-9b81-63d373eb4caa";
389389
PROVISIONING_PROFILE_SPECIFIER = "Google Development";
@@ -401,7 +401,7 @@
401401
DEVELOPMENT_TEAM = EQHXZ8M8AV;
402402
INFOPLIST_FILE = "text-recognition/Info.plist";
403403
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
404-
PRODUCT_BUNDLE_IDENTIFIER = com.google.firebase.codelab.mlkit;
404+
PRODUCT_BUNDLE_IDENTIFIER = com.google.firebaseml.sampleapp;
405405
PRODUCT_NAME = "$(TARGET_NAME)";
406406
PROVISIONING_PROFILE = "dac40987-e637-434d-9b81-63d373eb4caa";
407407
PROVISIONING_PROFILE_SPECIFIER = "Google Development";

mlkit-ios/text-recognition/final/text-recognition/text-recognition/GoogleService-Info.plist

Lines changed: 0 additions & 40 deletions
This file was deleted.

mlkit-ios/text-recognition/final/text-recognition/text-recognition/ViewController.swift

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct ImageDisplay {
2525
class ViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource {
2626

2727
var textDetector: VisionTextDetector!
28-
var cloudTextDetector: VisionCloudTextDetector!
28+
var cloudTextDetector: VisionCloudDocumentTextDetector!
2929

3030
var frameSublayer = CALayer()
3131

@@ -37,10 +37,19 @@ class ViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSo
3737
ImageDisplay(file: "walk-on-grass", name: "Image 2"),
3838
]
3939

40+
override func viewDidAppear(_ animated: Bool) {
41+
super.viewDidAppear(animated)
42+
// textDetector = Vision().textDetector()
43+
// cloudTextDetector = Vision().cloudTextDetector()
44+
let vision = Vision.vision()
45+
textDetector = vision.textDetector()
46+
cloudTextDetector = vision.cloudDocumentTextDetector()
47+
48+
}
49+
4050
override func viewDidLoad() {
4151
super.viewDidLoad()
42-
textDetector = Vision().textDetector()
43-
cloudTextDetector = Vision().cloudTextDetector()
52+
4453

4554
imageView.layer.addSublayer(frameSublayer)
4655
pickerView.dataSource = self
@@ -112,10 +121,17 @@ class ViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSo
112121
for block in page.blocks ?? [] {
113122
for paragraph in block.paragraphs ?? [] {
114123
for word in paragraph.words ?? [] {
124+
var wordText = ""
125+
for symbol in word.symbols ?? [] {
126+
if let text = symbol.text {
127+
wordText = wordText + text
128+
}
129+
}
115130
self.addFrameView(
116131
featureFrame: word.frame,
117132
imageSize: image.size,
118-
viewFrame: self.imageView.frame
133+
viewFrame: self.imageView.frame,
134+
text: wordText
119135
)
120136
}
121137
}

0 commit comments

Comments
 (0)