Skip to content

Commit 7bcc50f

Browse files
committed
fix build with non-Darwin Foundation
non-Darwin platforms such as Linux require an explicit cast from String to NSString
1 parent 799fad3 commit 7bcc50f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/SwiftASCII/String.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ extension StringProtocol {
4646
/// will be substituted.
4747
@available(OSX 10.11, iOS 9.0, *)
4848
public var asciiStringLossy: ASCIIString {
49-
let transformed = applyingTransform(
49+
#if canImport(Darwin)
50+
let this = self
51+
#else
52+
let this = String(self) as NSString
53+
#endif
54+
let transformed = this.applyingTransform(
5055
StringTransform("Latin-ASCII"),
5156
reverse: false
5257
)

0 commit comments

Comments
 (0)