Skip to content

Commit ebeb819

Browse files
authored
Merge pull request #3 from lhoward/lhoward/linux
fix build with non-Darwin Foundation
2 parents 799fad3 + 1699cbd commit ebeb819

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,13 @@ jobs:
176176
- name: Unit Tests
177177
if: steps.destnameprep.outcome != 'failure'
178178
run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=watchOS Simulator,name=$DESTNAME" | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]}
179+
180+
linux:
181+
name: Linux
182+
runs-on: ubuntu-latest
183+
steps:
184+
- uses: actions/checkout@main
185+
- name: Build
186+
run: swift build
187+
- name: Unit Tests
188+
run: swift test

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)