Skip to content

Commit 85b0f65

Browse files
authored
Merge pull request #75 from marcprux/main
Android support
2 parents 604df92 + c3318d7 commit 85b0f65

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,11 @@ jobs:
120120
run: swift build --build-tests
121121
- name: Test
122122
run: swift test --skip-build
123+
124+
android:
125+
runs-on: ubuntu-latest
126+
steps:
127+
- name: Checkout
128+
uses: actions/checkout@v4
129+
- name: Build and Test
130+
uses: skiptools/swift-android-action@v2

CommandLine/main.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
#if canImport(Darwin)
3333
import Darwin.POSIX
34+
#elseif canImport(Android)
35+
import Android
3436
#else
3537
import Glibc
3638
#endif

SwiftDraw/LayerTree.Transform.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
#if canImport(Darwin)
3333
import Darwin
34+
#elseif canImport(Android)
35+
import Android
3436
#else
3537
import Glibc
3638
#endif
@@ -114,3 +116,15 @@ extension Array where Element == LayerTree.Transform {
114116
}
115117
}
116118
}
119+
120+
#if os(Android)
121+
// The Android module does not have Float overloads for the various math functions
122+
func tan(_ value: Float) -> Float { tanf(value) }
123+
func atan(_ value: Float) -> Float { atanf(value) }
124+
func cos(_ value: Float) -> Float { cosf(value) }
125+
func acos(_ value: Float) -> Float { acosf(value) }
126+
func sin(_ value: Float) -> Float { sinf(value) }
127+
func asin(_ value: Float) -> Float { asinf(value) }
128+
func ceil(_ value: Float) -> Float { ceilf(value) }
129+
#endif
130+

0 commit comments

Comments
 (0)