is it possible to ship some swift code together wi...
# multiplatform
a
is it possible to ship some swift code together with the exported KMP Obj-C framework?
s
Yes it is possible. That Swift code will need to be bundled with your framework when you make it available using Cocoapods or SPM.
a
Do you know where I can find an example of that?
s
Let me try to find some example. But what you want to achieve is not KMP related, but only Swift/iOS. You want to have both swift file and a framework
a
Okay, thanks.
s
For Swift Package Manager, it might look something like that:
Copy code
let package = Package(
    name: "SomeLib",
    platforms: [
        .iOS(.v13)
    ],
    products: [
        // Products define the executables and libraries a package produces, and make them visible to other packages.
        .library(
            name: "SomeLib",
            targets: ["SomeLib"]),
        .library(
            name: "SwiftSomeLib",
            targets: ["SwiftSomeLib"]
        ),
    ],
    targets: [
        .binaryTarget(
            name: "SomeLib",
            url: "<https://some.com/somelib-1.0.0-beta1-xcframework.zip>",
            checksum: "1f9d0d78f358dbf17cdebdf1766dd49a6a1bb272d841d9cc30a725a1f44ab5f2"
        ),
        .target(
            name: "SwiftSomeLib",
            dependencies: ["SomeLib"],
            path: "shared/src/swift",
            exclude: [],
            sources: [
                "SwiftSomeLib.swift" // Swift file
            ]
        )
    ]
)
For Cocoapods, haven't found an example. But I'm sure it's possible 🙂
a
No, worries . Thank you so much
s
Pleasure 🙂