icerockdev / moko-kswift

Swift-friendly api generator for Kotlin/Native frameworks
https://moko.icerock.dev
Apache License 2.0
351 stars 21 forks source link

No way to specify spec.ios.deployment_target for generated spec file #13

Closed mattmook closed 3 years ago

mattmook commented 3 years ago

Because there's no way to specify the iOS deployment target, the build defaults to the lowest support iOS version (I believe iOS 4.3) for the sharedSwift project. This results in the build failing with:

<unknown>:0: error: Swift requires a minimum deployment target of iOS 7
Command CompileSwiftSources failed with a nonzero exit code

This can be worked around by forcing the target in the projects Podfile, but this is obviously not ideal.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

Firstly it would be good to have a setting to be able to specify this. Although, would it make sense for a future version to use the cocoapods plugin configuration if available?

Alex009 commented 3 years ago

hi! do you have platform :ios, '11.0' in your Podfile? with required for you version. Just our generated podspec not contains any target version and as i think this line set target for all pods which not have any own settings. in sample app i not see any problems

mattmook commented 3 years ago

I have platform :ios, '14.1' in my Podspec as the code I was attempting to generate uses SwiftUI and Combine. platform sets the main projects target not that of its dependencies.

See https://stackoverflow.com/a/37289688/425538 and https://github.com/CocoaPods/CocoaPods/issues/4859

Alex009 commented 3 years ago

ability to set iosDeploymentTarget was added in 0.3.0 - see readme for details

mattmook commented 3 years ago

Thanks, much appreciated. Worth adding the same for macOS, tvOS and watchOS?

Alex009 commented 3 years ago

i not test kswift with not ios apple targets, not know what will work what not...i think it should be separated issue for support all of apple targets - we should implement samples for testing at all, and deployment_target control