Skip to content

Commit a8055a5

Browse files
Merge release/6.2.1 to release/6.2 (#1501)
* 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: Jeremy Schonfeld <[email protected]>
1 parent 24b307f commit a8055a5

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
@@ -417,7 +417,11 @@ extension Locale.Region {
417417

418418
/// An array of the sub-regions, matching the specified category of the region.
419419
@available(FoundationPreview 6.2, *)
420-
public func subRegions(ofCategoy category: Category) -> [Locale.Region] {
420+
#if FOUNDATION_FRAMEWORK
421+
// Renamed in 6.2.1
422+
@abi(func subRegions(ofCategoy category: Category) -> [Locale.Region])
423+
#endif
424+
public func subRegions(ofCategory category: Category) -> [Locale.Region] {
421425
var status = U_ZERO_ERROR
422426
let icuRegion = uregion_getRegionFromCode(identifier, &status)
423427
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)