You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -42,20 +60,34 @@ Use the Objective-C-compatible products directly if you need lower-level access:
42
60
For Objective-C-compatible core APIs:
43
61
44
62
```ruby
45
-
pod 'libPhoneNumber-iOS', '~> 1.5'
63
+
pod 'libPhoneNumber-iOS', '~> 1.6'
64
+
```
65
+
66
+
For the Swift-first core facade:
67
+
68
+
```ruby
69
+
pod 'libPhoneNumber-iOS-SwiftCore', '~> 1.6'
70
+
```
71
+
72
+
Optional Swift facade modules:
73
+
74
+
```ruby
75
+
pod 'libPhoneNumber-iOS-SwiftGeocoding', '~> 1.6'
76
+
pod 'libPhoneNumber-iOS-SwiftShortNumber', '~> 1.6'
77
+
pod 'libPhoneNumber-iOS-SwiftUI', '~> 1.6'
46
78
```
47
79
48
-
For the Swift-first facade:
80
+
For the backwards-compatible Swift umbrella facade:
49
81
50
82
```ruby
51
-
pod 'libPhoneNumberSwift', '~> 1.5'
83
+
pod 'libPhoneNumber-iOS-Swift', '~> 1.6'
52
84
```
53
85
54
86
Optional modules:
55
87
56
88
```ruby
57
-
pod 'libPhoneNumberGeocoding', '~> 1.5'
58
-
pod 'libPhoneNumberShortNumber', '~> 1.5'
89
+
pod 'libPhoneNumberGeocoding', '~> 1.6'
90
+
pod 'libPhoneNumberShortNumber', '~> 1.6'
59
91
```
60
92
61
93
### Carthage
@@ -72,10 +104,10 @@ Add the source files from the modules you need and link `Contacts.framework` for
72
104
73
105
## Swift Quick Start
74
106
75
-
Prefer `libPhoneNumberSwift` for new Swift code:
107
+
Prefer `libPhoneNumberSwiftCore` for new Swift code that only needs parsing, formatting, validation, and as-you-type formatting:
76
108
77
109
```swift
78
-
importlibPhoneNumberSwift
110
+
importlibPhoneNumberSwiftCore
79
111
80
112
let phoneUtil = PhoneNumberUtility.shared
81
113
let phoneNumber =try phoneUtil.parse("01065431234", defaultRegion: "KR")
@@ -87,10 +119,21 @@ let numberType = phoneUtil.type(of: phoneNumber)
87
119
88
120
The Swift facade delegates to the Objective-C implementation. Phone number parsing and validation logic should stay in the Objective-C core so upstream behavior remains centralized.
89
121
122
+
For storage, concurrency boundaries, or API responses, use the immutable value wrapper:
123
+
124
+
```swift
125
+
let value =try phoneUtil.value(from: "01065431234", defaultRegion: "KR").get()
126
+
127
+
value.e164
128
+
value.regionCode
129
+
value.nationalSignificantNumber
130
+
value.type
131
+
```
132
+
90
133
### As-You-Type Formatting
91
134
92
135
```swift
93
-
importlibPhoneNumberSwift
136
+
importlibPhoneNumberSwiftCore
94
137
95
138
let formatter =AsYouTypeFormatter(regionCode: "US")
@@ -246,6 +320,16 @@ swift scripts/updateGeocodingMetadata.swift --source /tmp/libphonenumber --outpu
246
320
247
321
Use `--output` to inspect generated databases before replacing the checked-in bundle. Use `--source` when you already have a local Google libphonenumber checkout or an extracted `resources/geocoding` directory.
248
322
323
+
### Freshness Check
324
+
325
+
Generate a current-vs-upstream metadata freshness summary and issue/PR text candidates:
326
+
327
+
```bash
328
+
swift scripts/checkMetadataFreshness.swift --output .build/metadata-freshness
329
+
```
330
+
331
+
The script writes review artifacts only. It does not modify checked-in metadata.
332
+
249
333
## Validation
250
334
251
335
Before merging behavior, metadata, packaging, or API changes, run the relevant checks from [docs/TESTING.md](docs/TESTING.md).
@@ -263,7 +347,11 @@ git diff --check
263
347
For Swift facade changes:
264
348
265
349
```bash
266
-
pod lib lint libPhoneNumberSwift.podspec --allow-warnings --include-podspecs='*.podspec'
350
+
pod lib lint libPhoneNumber-iOS-SwiftCore.podspec --allow-warnings --include-podspecs='*.podspec'
351
+
pod lib lint libPhoneNumber-iOS-SwiftGeocoding.podspec --allow-warnings --include-podspecs='*.podspec'
352
+
pod lib lint libPhoneNumber-iOS-SwiftShortNumber.podspec --allow-warnings --include-podspecs='*.podspec'
353
+
pod lib lint libPhoneNumber-iOS-SwiftUI.podspec --allow-warnings --include-podspecs='*.podspec'
354
+
pod lib lint libPhoneNumber-iOS-Swift.podspec --allow-warnings --include-podspecs='*.podspec'
Google libphonenumber ships carrier and timezone metadata outside the JavaScript metadata currently mirrored by this project. Adding those datasets could differentiate this library for global and enterprise apps, but it should be treated as a separate feature area rather than folded into the core parser.
4
+
5
+
## Recommended Direction
6
+
7
+
- Keep carrier and timezone metadata out of `libPhoneNumberSwiftCore`.
8
+
- Add separate Objective-C metadata bundles and Swift facade modules only if there is confirmed product demand.
9
+
- Prefer opt-in packages:
10
+
-`libPhoneNumberCarrier`
11
+
-`libPhoneNumberTimezone`
12
+
-`libPhoneNumberSwiftCarrier`
13
+
-`libPhoneNumberSwiftTimezone`
14
+
- Measure bundle size before adding checked-in metadata.
15
+
16
+
## Required Work Before Implementation
17
+
18
+
1. Identify the exact upstream metadata source files and license implications.
19
+
2. Build deterministic generators for carrier and timezone metadata.
20
+
3. Add tests against upstream examples.
21
+
4. Add package-size reporting to the release checklist.
0 commit comments