Skip to content

Commit

Permalink
new release (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankois944 authored Jan 16, 2025
1 parent 11ffdd6 commit 05671cb
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pre-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
uses: actions/cache@v4
with:
path: |
example/build/spmKmpPlugin/scratch
example/build/spmKmpPlugin
example/iosApp/spm
example/iosApp/build
key: ${{ runner.os }}-example-scratch
Expand Down
46 changes: 42 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Add the plugin to your `build.gradle.kts` or the appropriate Gradle module’s `
```kotlin
plugins {
id("org.jetbrains.kotlin.multiplatform")
id("io.github.frankois944.spmForKmp").version("0.0.6") // Apply the spmForKmp plugin
id("io.github.frankois944.spmForKmp").version("0.0.8") // Apply the spmForKmp plugin
}
```

Expand Down Expand Up @@ -101,7 +101,7 @@ swiftPackageConfig {
url = URI("https://github.com/krzyzanowskim/CryptoSwift.git"),
version = "1.8.1",
products = {
// Can be only used in your "src/swift" code.
// Can be only used in your "src/swift/nativeExample" code.
add("CryptoSwift")
},
),
Expand All @@ -125,7 +125,7 @@ For more information, refer to the [SwiftDependency](https://github.com/frankois

### 3. Add your embedded Swift code

You can now add your embedded Swift code in the `src/swift` folder.
You can now add your embedded Swift code in the `src/swift/[cinteropname]` folder.

> [!IMPORTANT]
> Your swift code need to be mark as [@objc/@objcMembers](https://akdebuging.com/posts/what-is-objc-and-objcmember/) and the visibility set as `public`
Expand Down Expand Up @@ -163,7 +163,7 @@ swiftPackageConfig {
```swift
import Foundation
import CryptoSwift
// inside the folder src/swift
// inside the folder src/swift/dummy
// the class will be automatically accessible from your Kotlin code
@objcMembers public class MySwiftDummyClassWithDependencies: NSObject {
public func toMD5(value: String) -> String {
Expand Down Expand Up @@ -205,6 +205,44 @@ swiftPackageConfig {
> Add the folder to your project as a Local package, that's all.
### 4. Configuration by target
You can set a different configuration for each each target you manage.
```kotlin
listOf(
iosX64(),
iosSimulatorArm64(),
).forEach {
it.compilations {
val main by getting {
cinterops.create("nativeIosShared") // a config for iOS
}
}
}
listOf(
macosArm64(),
).forEach {
it.compilations {
val main by getting {
cinterops.create("nativeMacosShared") // a config for macos
}
}
}
swiftPackageConfig {
create("nativeIosShared") {
// your embedded swift is inside the folder src/swift/nativeIosShared
// your config for iOS
}
create("nativeMacosShared") {
// your embedded swift is inside the folder src/swift/nativeMacosShared
// your config for macOS
}
}
```
---

## License
Expand Down
2 changes: 1 addition & 1 deletion plugin-build/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ID=io.github.frankois944.spmForKmp
VERSION=0.0.7
VERSION=0.0.8
ARTIFACT_ID=Spm4Kmp
GROUP=io.github.frankois944
DISPLAY_NAME=Swift Package Manager for Kotlin Multiplaform
Expand Down

0 comments on commit 05671cb

Please sign in to comment.