Repository navigation
Conversation
Annotate 20 methods across NBAsYouTypeFormatter, NBMetadataHelper and NSArray+NBAdditions. Preserve unaudited Swift imports and existing implementations.
iziz
approved these changes
Nov 13, 2026
iziz
left a comment
Owner
There was a problem hiding this comment.
Thanks for taking the time to audit these APIs and verify how they import into Swift. Looks good to me!
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.
Summary
Swift currently imports these unannotated Objective-C APIs as implicitly unwrapped optionals. Add explicit nullability to 20 methods in three public headers so guaranteed results are nonoptional and lookups that can fail return optionals.
NBAsYouTypeFormatter(8 methods): both constructors and all six string results are nonnull; regions and string input remain nullable, and an injected metadata helper is required.NBMetadataHelper(7 methods): the default initializer and two collection results are nonnull; the four lookup results are nullable.NSArray+NBAdditions(5 methods): safe lookup results are nullable for missing indices and mismatched types.Unaudited declarations and parameters keep their existing Swift imports. Three metadata-helper arguments remain unannotated because the implementation already declares them nonnull; narrowly scoped completeness-warning pragmas avoid conflicting annotations without changing the public parameter contract.
This PR changes only the three headers. Implementations, models, generics, existing
NBPhoneNumberUtilcontracts, and metadata are unchanged. Swift callers that relied on implicit unwrapping of nullable lookup results may need explicit optional handling.Upstream / Metadata
v9.0.43.iziz/libPhoneNumber-iOSmaster at91fcc7452b8baa55fc2f61519f24b1f87ae4716f.Parity Checks
swift scripts/checkUpstreamTestParity.swift --upstream-ref v9.0.43swift scripts/checkUpstreamAPIParity.swift --upstream-ref v9.0.43Tests
Validation used a temporary local harness, outside this header-only diff:
-Werror=nullability-completeness: no warnings.git diff --checkChangelog
CHANGELOG.mdis not changed; this contribution is limited to the three audited headers.Notes