Repository navigation
Conversation
…tall TextRecognitionServiceFactory wrapped each `case` of `switch language` in its own `#if MLKIT_TEXT_RECOGNITION*` flag with no `default:`. Disabling any single language model compiled that case out while DomainTextRecognitionLanguage still declared all five, so the switch was no longer exhaustive and iOS failed to build with "switch must be exhaustive". Every partial selection broke; only all-five-enabled or all-five-disabled (where MLKIT_TEXT_RECOGNITION_ANY drops the whole file) compiled, which defeats the point of selective install. Move the `#if` guards inside each `case` body via a `makeOptions(for:)` helper returning nil for models excluded from the build. The switch now lists all five cases unconditionally, so it stays exhaustive under every flag combination and adding a language still fails the build until it is handled here — which a `default:` clause would have silently swallowed. Unavailable languages now throw a descriptive RuntimeError naming the configuration key to enable, matching the IllegalStateException Android already throws from its own factory, instead of crashing via fatalError. createTextRecognizer/create become throwing, so HybridTextRecognizer.init throws and its only call site in HybridVisionCameraMLKit uses `try`. Fixes #22
Records the fix under [Unreleased]; the version header gets stamped at release time. Describes the failure mode (non-exhaustive switch under any partial language selection) and the new behavior for languages excluded from the build.
…on-build fix(ios): keep text recognition switch exhaustive under selective install
Release candidate carrying the iOS selective-install build fix (#22) so the reporter can validate against the real published artifact before 2.0.1 goes out under the latest tag. The release workflow maps the -rc. tag suffix to the npm rc dist-tag, so latest stays on 2.0.0. Stamps the CHANGELOG entry as 2.0.1-rc.0 and regenerates the example Podfile.lock, which embeds the package version.
Promotes 2.0.1-rc.0 to the final release after the reporter of #22 confirmed the release candidate resolves the iOS selective-install build failure. The changelog section is renamed from 2.0.1-rc.0 to 2.0.1 rather than duplicated, since the shipped content is identical and the rc existed only to validate the fix against a real published artifact.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release 2.0.1 — patch release promoting
2.0.1-rc.0tolatestafter thereporter of #22 confirmed the release candidate resolves the failure.
The fix commit (
2658145) body containsFixes #22. That keyword is inert ondevelop, but lands on the default branch with this merge, so GitHub willclose the issue at merge time — before the tag, release, and npm publish
complete. Expected and accounted for; the closing comment goes up after the
publish lands.
What ships
Only the iOS selective ML Kit install build fix. No other work is riding along
—
mainalready has everything else.Text recognition could not build on iOS whenever any language model was
disabled through the selective install, because each
caseof the switch overDomainTextRecognitionLanguagewas wrapped in its own#if MLKIT_TEXT_RECOGNITION*flag while the enum declared all fiveunconditionally, leaving the switch non-exhaustive. Every partial selection —
the feature's whole purpose — failed with
switch must be exhaustive. Theguards now live inside each case body, so the switch stays exhaustive under
every flag combination, and an excluded language throws a descriptive error
naming the config key to enable, matching Android, instead of crashing.
Full detail in #23.
Commits
265814587c0417bb57f2579e311760359843ddf864Diff
6 files.
TextRecognitionServiceFactory.swiftis the fix;HybridTextRecognizer.swiftandHybridVisionCameraMLKit.swiftpropagatethrows;package.jsonandexample/ios/Podfile.lockcarry the version;CHANGELOG.mdgets the[2.0.1]section.The CHANGELOG section was renamed from
[2.0.1-rc.0]to[2.0.1]rather thanduplicated — shipped content is identical and the rc existed only to validate
against a real published artifact.
Validation
Verified on the RC by the reporter on their EAS build, and locally with real
pod install+xcodebuildper configuration, reading the emittedSWIFT_ACTIVE_COMPILATION_CONDITIONSback from the generated xcconfig:switch must be exhaustiveat 31:7The published
2.0.1-rc.0tarball was also pulled back from the registry andconfirmed to contain the fixed sources.
After merge
v2.0.1on the merge commitlatestdist-tags.latest = 2.0.1