Open luca992 opened 2 years ago
Unfortunately it doesn't appear that this project is maintained anymore.
I tried the https://github.com/doublesymmetry/kotlin-spm-plugin fork, which fixes the annotation issues, but then fails during temporary Xcode project creation:
The generate-xcodeproj
option for the swift
tool has long been deprecated and removed.
I attempted to switch to using xcodegen
to produce a temporary project (for building a temporary framework for the cinterop) but could not get headers from the output framework.
I imagine it would take quite a bit of work to get this project in working order again. 😢
@twyatt I'd be interested to try and take this on. I think it may be achievable using swift build
.
However may be blocked when building libraries which depend on Obj-C.
For instance if I try to import AVFoundation
:
swift build -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios14.0-simulator"
#import <AVFoundation/AVDisplayCriteria.h>
^
<unknown>:0: error: could not build Objective-C module 'AVFoundation'
error: fatalError
https://forums.swift.org/t/swiftpm-swift-build-for-ios/42517/4
Building without import works fine:
swift build -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios14.0-simulator"
Building for debugging...
<unknown>:0: warning: using sysroot for 'MacOSX' but targeting 'iPhone'
<unknown>:0: warning: using sysroot for 'MacOSX' but targeting 'iPhone'
[6/6] Archiving libRadioPlayerLocal.a
Build complete! (0.43s)
https://youtrack.jetbrains.com/issue/KT-53877/Support-Swift-Package-Manager-in-Kotlin-Multiplatform
Comment on the Jetbrains issue could be relevant.
I need to investigate using Gradle plugin to build swift Package.swft
.
https://docs.gradle.org/current/userguide/building_swift_projects.html https://docs.gradle.org/current/userguide/swift_library_plugin.html#swift_library_plugin
mmm perhaps not possible with Gradle plugin, seems iOS not available:
Using the following command I can build my Package.swift
directly which produces output binary.
xcodebuild build -scheme RadioPlayerLocal -sdk "`xcrun --sdk iphonesimulator --show-sdk-path`" -destination "OS=17.1,name=iPhone 13 Pro"
xcodebuild build
produces a Mach-O object .o
file rather than a framework/static library.
possibly need to take steps like this in order to produce a packaged XCFramework: https://mustafa-ysf.medium.com/creating-xcframework-from-swift-package-e8af6f44501f
Also a helper here I've yet to try: https://github.com/mstfy/spm-to-xcframework
I can't get gradle to build after adding a spm dependency:
I'm using kotlin 1.6.21