Skip to content

Commit 7fc51e7

Browse files
Add IOS support
1 parent 9b4a1d8 commit 7fc51e7

File tree

5 files changed

+23
-1
lines changed

5 files changed

+23
-1
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ concurrency:
1414

1515
jobs:
1616
build:
17-
runs-on: ubuntu-latest
17+
runs-on: macos-latest
1818

1919
steps:
2020
- name: Checkout

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ vanniktech-maven = "0.29.0"
1515
[libraries]
1616
ktor-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
1717
ktor-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
18+
ktor-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor" }
1819
ktor-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
1920
ktor-kotlinx-serialization = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
2021
ktor-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }

podcastindex-sdk/build.gradle.kts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ kotlin {
2525
coreLibrariesVersion = libs.versions.kotlinTarget.get()
2626

2727
jvm()
28+
listOf(
29+
iosX64(),
30+
iosArm64(),
31+
iosSimulatorArm64(),
32+
).forEach {
33+
it.binaries.framework {
34+
baseName = "podcastindex-sdk"
35+
isStatic = true
36+
}
37+
}
2838

2939
sourceSets {
3040
commonMain.dependencies {
@@ -41,6 +51,10 @@ kotlin {
4151
implementation(libs.ktor.okhttp)
4252
}
4353

54+
iosMain.dependencies {
55+
implementation(libs.ktor.darwin)
56+
}
57+
4458
commonTest.dependencies {
4559
implementation(kotlin("test"))
4660
}

podcastindex-sdk/src/commonMain/kotlin/com/mr3y/podcastindex/extensions/HttpClient.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import io.ktor.client.request.headers
1212
import io.ktor.http.HttpStatusCode
1313
import io.ktor.serialization.kotlinx.json.json
1414
import io.ktor.util.sha1
15+
import io.ktor.utils.io.core.toByteArray
1516
import kotlinx.datetime.Clock
1617
import kotlinx.serialization.json.Json
1718
import co.touchlab.kermit.Logger as KermitLogger
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.mr3y.podcastindex
2+
3+
import io.ktor.client.engine.HttpClientEngineFactory
4+
import io.ktor.client.engine.darwin.Darwin
5+
6+
internal actual fun defaultHttpClientEngineFactory(): HttpClientEngineFactory<*> = Darwin

0 commit comments

Comments
 (0)