Skip to content

Commit 5e5e183

Browse files
committed
Mark NFD and NFC as SPI
underscore Unicode SPI
1 parent b6b64c9 commit 5e5e183

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

stdlib/public/core/NFC.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
import SwiftShims
1414

1515
extension Unicode {
16-
internal struct _NFC<S: StringProtocol> {
16+
@_spi(_Unicode)
17+
public struct _NFC<S: StringProtocol> {
1718
let base: S
1819
}
1920
}
2021

2122
extension Unicode._NFC {
22-
internal struct Iterator {
23+
@_spi(_Unicode)
24+
public struct Iterator {
2325
var buffer = Unicode._NormDataBuffer()
2426

2527
// This is our starter that is currently being composed with other scalars
@@ -98,7 +100,8 @@ extension Unicode._NFC.Iterator: IteratorProtocol {
98100
}
99101
}
100102

101-
internal mutating func next() -> Unicode.Scalar? {
103+
@_spi(_Unicode)
104+
public mutating func next() -> Unicode.Scalar? {
102105
// Empty out our buffer before attempting to compose anything with our new
103106
// composee.
104107
if let nextBuffered = buffer.next() {
@@ -211,13 +214,15 @@ extension Unicode._NFC.Iterator: IteratorProtocol {
211214
}
212215

213216
extension Unicode._NFC: Sequence {
214-
internal func makeIterator() -> Iterator {
217+
@_spi(_Unicode)
218+
public func makeIterator() -> Iterator {
215219
Iterator(iterator: base._nfd.makeIterator())
216220
}
217221
}
218222

219223
extension StringProtocol {
220-
internal var _nfc: Unicode._NFC<Self> {
224+
@_spi(_Unicode)
225+
public var _nfc: Unicode._NFC<Self> {
221226
Unicode._NFC(base: self)
222227
}
223228
}

stdlib/public/core/NFD.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
extension Unicode {
14-
internal struct _NFD<S: StringProtocol> {
14+
@_spi(_Unicode)
15+
public struct _NFD<S: StringProtocol> {
1516
let base: S
1617
}
1718
}
1819

1920
extension Unicode._NFD {
20-
internal struct Iterator {
21+
@_spi(_Unicode)
22+
public struct Iterator {
2123
var buffer = Unicode._NormDataBuffer()
2224

2325
// This index always points at the next starter of a normalization segment.
@@ -124,7 +126,8 @@ extension Unicode._NFD.Iterator: IteratorProtocol {
124126
}
125127
}
126128

127-
internal mutating func next() -> ScalarAndNormData? {
129+
@_spi(_Unicode)
130+
public mutating func next() -> ScalarAndNormData? {
128131
// Empty out our buffer before attempting to decompose the next
129132
// normalization segment.
130133
if let nextBuffered = buffer.next() {
@@ -166,7 +169,8 @@ extension Unicode._NFD.Iterator: IteratorProtocol {
166169
}
167170

168171
extension Unicode._NFD: Sequence {
169-
internal func makeIterator() -> Iterator {
172+
@_spi(_Unicode)
173+
public func makeIterator() -> Iterator {
170174
Iterator(
171175
index: base.unicodeScalars.startIndex,
172176
unicodeScalars: base.unicodeScalars
@@ -175,7 +179,8 @@ extension Unicode._NFD: Sequence {
175179
}
176180

177181
extension StringProtocol {
178-
internal var _nfd: Unicode._NFD<Self> {
182+
@_spi(_Unicode)
183+
public var _nfd: Unicode._NFD<Self> {
179184
Unicode._NFD(base: self)
180185
}
181186
}

stdlib/public/core/UnicodeData.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
import SwiftShims
1414

15-
internal typealias ScalarAndNormData = (
15+
@_spi(_Unicode)
16+
public typealias ScalarAndNormData = (
1617
scalar: Unicode.Scalar,
1718
normData: Unicode._NormData
1819
)
@@ -45,7 +46,8 @@ extension Unicode {
4546
// a scalar with a CCC value of 100, unless there are normalization
4647
// boundaries between them.
4748
//
48-
internal struct _NormData {
49+
@_spi(_Unicode)
50+
public struct _NormData {
4951
var rawValue: UInt16
5052

5153
var ccc: UInt8 {

0 commit comments

Comments
 (0)