This document defines the target direction for a Swift-first facade while keeping the Objective-C implementation as the stable behavioral core.
The Swift facade is split into feature-aligned targets. libPhoneNumberIOSSwift remains as a non-UI umbrella target and depends on:
libPhoneNumberlibPhoneNumberGeocodinglibPhoneNumberShortNumber
This is convenient for users who want one import, but it makes every Swift facade consumer link optional geocoding and short-number features even when they only need parsing, formatting, and validation.
Carrier, timezone, and SwiftUI enrichment modules are separate opt-in products and are not part of the umbrella module.
- Keep Objective-C as the source of truth for parsing, formatting, validation, geocoding, and short-number behavior.
- Let Swift consumers depend on a smaller core facade without pulling geocoding metadata or short-number APIs.
- Use
import libPhoneNumberIOSSwiftas the umbrella module. - Keep CocoaPods and Swift Package Manager product names predictable.
- Do not rewrite libphonenumber behavior in Swift.
- Do not rename or destabilize the Objective-C public API.
- Do not reintroduce third-party CocoaPods names owned by other maintainers.
| Module | Depends on | Public surface |
|---|---|---|
libPhoneNumberSwiftCore |
libPhoneNumber |
PhoneNumber, PhoneNumberUtility, AsYouTypeFormatter, Swift enums/errors |
libPhoneNumberSwiftGeocoding |
libPhoneNumberSwiftCore, libPhoneNumberGeocoding |
PhoneNumberGeocoder |
libPhoneNumberSwiftShortNumber |
libPhoneNumberSwiftCore, libPhoneNumberShortNumber |
ShortNumberUtility, short-number cost/type wrappers |
libPhoneNumberSwiftCarrier |
libPhoneNumberSwiftCore, libPhoneNumberCarrier |
PhoneNumberCarrierMapper |
libPhoneNumberSwiftTimeZones |
libPhoneNumberSwiftCore, libPhoneNumberTimeZones |
PhoneNumberTimeZonesMapper |
libPhoneNumberSwiftUI |
libPhoneNumberSwiftCore, SwiftUI |
PhoneNumberTextField, PhoneNumberFieldStyle, validation state |
libPhoneNumberSwiftUIEnrichment |
libPhoneNumberSwiftUI, libPhoneNumberSwiftCarrier, libPhoneNumberSwiftTimeZones |
CarrierTimeZonesPhoneNumberEnricher |
libPhoneNumberIOSSwift |
core, geocoding, short-number facade modules | Umbrella import |
The umbrella module should contain little or no behavior. Its purpose is compatibility and convenience.
Prefer explicit podspecs or subspecs that mirror the Swift Package products:
libPhoneNumber-iOS-SwiftCorelibPhoneNumber-iOS-SwiftGeocodinglibPhoneNumber-iOS-SwiftShortNumberlibPhoneNumber-iOS-SwiftCarrierlibPhoneNumber-iOS-SwiftTimeZoneslibPhoneNumber-iOS-SwiftUIlibPhoneNumber-iOS-SwiftUIEnrichmentlibPhoneNumber-iOS-Swiftas an umbrella pod
The umbrella pod should remain available and continue to depend on the core, geocoding, and short-number Swift facade modules. Carrier, timezone, and SwiftUI remain opt-in because they add metadata or UI-specific dependencies. New README examples should recommend libPhoneNumber-iOS-SwiftCore for parse/format-only apps.
- Document the split and keep the current product unchanged. Done.
- Move Swift facade files into feature-aligned directories without changing public symbols. Done.
- Add SPM targets/products for core, geocoding, short-number, and umbrella modules. Done.
- Add matching CocoaPods packaging and lint checks. Done.
- Update README examples to recommend the smallest product for each workflow. Done.
- Keep the umbrella product until at least one minor release after the split.
- A Swift app that only parses and formats phone numbers can depend on
libPhoneNumberSwiftCorewithout linking geocoding metadata. - The umbrella module uses
import libPhoneNumberIOSSwift, avoiding third-party CocoaPods names. - The Swift facade tests cover both the umbrella module and each split module.
- CI runs
swift test,swift build -c release, version consistency checks, and CocoaPods lint for every shipped podspec. - Any new Swift wrapper still delegates behavior to the Objective-C core.
- Run
swift scripts/checkVersionConsistency.swiftafter adding products or podspecs. - Run
swift testandLC_ALL=ko_KR.UTF-8 LANG=ko_KR.UTF-8 swift test. - Run
pod lib lintfor all Swift facade podspecs. - Inspect the package graph to confirm
libPhoneNumberSwiftCoredoes not depend on geocoding, short-number, carrier, timezone, or SwiftUI targets.