Skip to content

Commit 30595dd

Browse files
github-actions[bot]itingliujmschonfeld
authored
Merge release/6.2.1 to release/6.2 (#1501) (#1503)
* Update 6.2.1 package dependency branches (#1496) * Locale.Region subregion API is misspelled (#1495) With @abi we can make an ABI compatible change so existing clients can continue to work on user's 6.2 devices even after they adopt the correct name on 6.2.1 and above. But only use @abi for FOUNDATION_FRAMEWORK since ABI compatibility isn't a concern in other scenarios. --------- Co-authored-by: Tina L <[email protected]> Co-authored-by: Jeremy Schonfeld <[email protected]>
1 parent 3caa32c commit 30595dd

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

Sources/FoundationInternationalization/Locale/Locale+Components_ICU.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,11 @@ extension Locale.Region {
425425

426426
/// An array of the sub-regions, matching the specified category of the region.
427427
@available(FoundationPreview 6.2, *)
428-
public func subRegions(ofCategoy category: Category) -> [Locale.Region] {
428+
#if FOUNDATION_FRAMEWORK
429+
// Renamed in 6.2.1
430+
@abi(func subRegions(ofCategoy category: Category) -> [Locale.Region])
431+
#endif
432+
public func subRegions(ofCategory category: Category) -> [Locale.Region] {
429433
var status = U_ZERO_ERROR
430434
let icuRegion = uregion_getRegionFromCode(identifier, &status)
431435
guard let icuRegion, status.isSuccess else {

Tests/FoundationInternationalizationTests/LocaleRegionTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ struct LocaleRegionTests {
4343
}
4444

4545
@Test func subRegionOfCategory() async throws {
46-
#expect(Locale.Region.unknown.subRegions(ofCategoy: .world) == [])
47-
#expect(Locale.Region.unknown.subRegions(ofCategoy: .territory) == [])
46+
#expect(Locale.Region.unknown.subRegions(ofCategory: .world) == [])
47+
#expect(Locale.Region.unknown.subRegions(ofCategory: .territory) == [])
4848

49-
#expect(Set(Locale.Region.world.subRegions(ofCategoy: .continent)) == Set(Locale.Region.isoRegions(ofCategory: .continent)))
49+
#expect(Set(Locale.Region.world.subRegions(ofCategory: .continent)) == Set(Locale.Region.isoRegions(ofCategory: .continent)))
5050

51-
#expect(Locale.Region.argentina.subRegions(ofCategoy: .continent) == [])
52-
#expect(Locale.Region.argentina.subRegions(ofCategoy: .territory) == Locale.Region.argentina.subRegions)
51+
#expect(Locale.Region.argentina.subRegions(ofCategory: .continent) == [])
52+
#expect(Locale.Region.argentina.subRegions(ofCategory: .territory) == Locale.Region.argentina.subRegions)
5353

54-
#expect(Locale.Region("not a region").subRegions(ofCategoy: .territory) == [])
54+
#expect(Locale.Region("not a region").subRegions(ofCategory: .territory) == [])
5555
}
5656
}

0 commit comments

Comments
 (0)