Pat Teruel
12/07/2022, 9:03 AMPat Teruel
12/07/2022, 9:04 AMAdrian Witaszak
12/07/2022, 9:11 AMXCFramework,
which later is copied to another directory and used by React UI layer.
Initially, we were using assembleXCFramework
which took 3m 30s.
Then I changed it to assembleSharedReleaseXCFramework
and the build time decreased to 2m 15s, which is already great. XCFramework
generated, files copied all run fine.
But the assembleSharedReleaseXCFramework
still runs both tasks linkReleaseFrameworkIosX64
and linkReleaseFrameworkIosArm64
, which take about 65s each.
• We are all on MacBooks M1 in our team. Would you happen to know if we need both tasks to run?
• If I skip linkReleaseFrameworkIosX64
by adding -x linkReleaseFrameworkIosX64
, it runs the first task, but the job fails because XCFramework
is not generated.
• Do you think this is the right approach, or do you have suggestions?Robert Konczi
12/07/2022, 2:15 PM./gradlew :model:embedAndSignAppleFrameworkForXcode
has to be in the main app’s build phases. I can link the Appcore FW with the KMM Shared framework in the build settings but then I skip the build phase for the KMM Shared FW. Is there any way to use the KMM Shared framework in both targets simultaneously?leandro
12/09/2022, 6:35 PMmarzelwidmer
12/26/2022, 6:31 AMAppCode is no longer available as a commercial product as of December 14, 2022.
ursus
12/29/2022, 10:49 AMJon Bailey
12/29/2022, 1:05 PMJon Bailey
12/29/2022, 2:16 PMCould not create task ':shared:linkDebugFrameworkIosArm64'.
> Could not create task of type 'KotlinNativeLink'.
> Configuration with name 'iosArm64DebugFrameworkExport' not found.
I just have ./gradlew :shared:embedAndSignAppleFrameworkForXcode
in a build phase script as is recommended
Adding the info or debug flags desn't provide any useful extra information as far as I can see. I'm not really sure how to go about debugging this, or seeing why the configuration has not been created?
I see in the release notes for 1.8.0 it says:
The Kotlin Gradle plugin API is binary-compatible with previous releases. There are, however, some source and ABI-breaking changes in the kotlin-gradle-plugin artifact. Most of these changes involve additional generic parameters to some internal types. One important change is that the KotlinNativeLink task no longer inherits the AbstractKotlinNativeCompile task.
But I'm not sure if that is relevant nor how to get more info on itSean Howard
01/05/2023, 11:08 AMtouchlab/xcode-plugin
before that allows you to breakpoint Kotlin code within the Xcode project for KMM. Just wondering if any of you have come across this issue before whereby the breakpoints have stopped working indicating that the code isn’t getting compiled? Any ideas on how I might resolve this?
More detail in the issue I’ve posted here
https://github.com/touchlab/xcode-kotlin/issues/91
Not sure if this is better posted in #multiplatform or #kotlin-native, let me know!andrea.degaetano
01/05/2023, 2:37 PMLandry Norris
01/06/2023, 9:29 PMpod("FirebaseAnalytics")
in my build.gradle.kts, I get a missing symbol error when trying to run tests. If I add pod("FirebaseAnalytics")
, I get Compilation failed: Linking globals named 'knifunptr_cocoapods_FirebaseAnalytics0_kFIREventAdImpression_getter': symbol multiply defined!
. Is there a way to tell the cocoapods plugin that I want to pull down the binary, but I don’t care to have the cinterop generated in my module?Calogero
01/09/2023, 8:59 AMJan Kuchař
01/13/2023, 5:55 PMandylamax
01/16/2023, 8:47 AMList
(written in kotlin) is mapped to an `Array`/`NSArray` in Swift/OC
I know that a MutableList
is mapped to an NSMutableArray
but it is unclear what an Array
(written in kotlin) is mapped to in Swift.
is it also mapped into a
1. Array
/`NSArray`
2. NSMutableArray
3. KotlinArray
How is a kotlin Array mapped into a C as well?. Also not clear in the documentationLandry Norris
01/18/2023, 6:58 PMHakan
01/20/2023, 7:10 AMiosArm64Main
, iosX64Main
, iosSimulatorArm64Main
, etc) to an existing projects?
In my current project I have only iosMain
but I would like to have other modules as well because otherwise I am not able to build my cocoapod dependency and have error like this
Undefined symbols for architecture _*x86_64*_:.
ld: symbol(s) not found for architecture _*x86_64*_Daniele B
01/23/2023, 8:53 PMCannot infer a bundle ID from packages of source files and exported dependencies, use the bundle name instead: shared. Please specify the bundle ID explicitly using the -Xbinary=bundleId=<id> compiler flag.
Shubham Singh
01/26/2023, 12:54 PMios
module is set up to use cocoapods
But this is causing SwiftUI's preview to fail (i.e. the app runs fine, but I'm not able to see previews in XCode)
It gives the following error:
linker command failed with exit code 1 (use -v to see invocation)
----------------------------------------
LinkDylibError: Failed to build ContentView.swift
Linking failed: linker command failed with exit code 1 (use -v to see invocation)
| BuildInvocationError
|
| /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -F /Applications/Xcode.app/Contents/SharedFrameworks-iphonesimulator -target arm64-apple-ios15.0-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.1.sdk -L/Users/shubhamsingh/Library/Developer/Xcode/DerivedData/ios-ahzpwspogoxmxtfairhvwgbqqgwj/Build/Intermediates.noindex/Previews/ios/Intermediates.noindex/EagerLinkingTBDs -L/Users/shubhamsingh/Library/Developer/Xcode/DerivedData/ios-ahzpwspogoxmxtfairhvwgbqqgwj/Build/Intermediates.noindex/Previews/ios/Products/Debug-iphonesimulator -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.1.sdk/usr/lib/swift -F/Users/shubhamsingh/Library/Developer/Xcode/DerivedData/ios-ahzpwspogoxmxtfairhvwgbqqgwj/Build/Intermediates.noindex/Previews/ios/Intermediates.noindex/EagerLinkingTBDs -F/Users/shubhamsingh/Library/Developer/Xcode/DerivedData/ios-ahzpwspogoxmxtfairhvwgbqqgwj/Build/Intermediates.noindex/Previews/ios/Products/Debug-iphonesimulator -F/Users/shubhamsingh/Library/Developer/Xcode/DerivedData/ios-ahzpwspogoxmxtfairhvwgbqqgwj/Build/Intermediates.noindex/Previews/ios/Products/Debug-iphonesimulator/KMPNativeCoroutinesCore -F/Users/shubhamsingh/Library/Developer/Xcode/DerivedData/ios-ahzpwspogoxmxtfairhvwgbqqgwj/Build/Intermediates.noindex/Previews/ios/Products/Debug-iphonesimulator/KMPNativeCoroutinesRxSwift -F/Users/shubhamsingh/Library/Developer/Xcode/DerivedData/ios-ahzpwspogoxmxtfairhvwgbqqgwj/Build/Intermediates.noindex/Previews/ios/Products/Debug-iphonesimulator/RxSwift -F/Users/shubhamsingh/IdeaProjects/PlayTogetherKMP/ios/Pods/../../shared/build/cocoapods/framework -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -lsqlite3 -ObjC -lc++ -framework KMPNativeCoroutinesCore -framework KMPNativeCoroutinesRxSwift -framework RxSwift -framework shared -framework Pods_ios -bundle -bundle_loader /Users/shubhamsingh/Library/Developer/Xcode/DerivedData/ios-ahzpwspogoxmxtfairhvwgbqqgwj/Build/Intermediates.noindex/Previews/ios/Products/Debug-iphonesimulator/ios.app/ios /Users/shubhamsingh/Library/Developer/Xcode/DerivedData/ios-ahzpwspogoxmxtfairhvwgbqqgwj/Build/Intermediates.noindex/Previews/ios/Intermediates.noindex/ios.build/Debug-iphonesimulator/ios.build/Objects-normal/arm64/ContentView.1.preview-thunk.o -o /Users/shubhamsingh/Library/Developer/Xcode/DerivedData/ios-ahzpwspogoxmxtfairhvwgbqqgwj/Build/Intermediates.noindex/Previews/ios/Intermediates.noindex/ios.build/Debug-iphonesimulator/ios.build/Objects-normal/arm64/ContentView.1.preview-thunk.dylib -framework SwiftUI
I found a GitHub issue that matches what I'm trying to say: https://github.com/JetBrains/kotlin-native/issues/3059
In this issue, they talk about making isStatic = false
in the shared build.gradle.kts
But if I do that, neither the app works nor the previews
When trying to see the preview, XCode shows this error:
ios crashed because shared.framework is missing
dyld_sim [
Library not loaded: @rpath/shared.framework/shared
And when trying to run the app, it crashes while giving the following error:Landry Norris
01/26/2023, 7:32 PMFoso
01/27/2023, 5:02 PMShubham Singh
01/30/2023, 11:31 AMshared
module in it (image attached below for the same).
If I remove any code that is coming from Kotlin (or the shared
module), the previews start working fine again 👍
I'm using Kotlin version 1.7.21
and the Regular framework
in iOS instead of Cocoapods
since Cocoapods was not able to generate any previews at all. The regular framework is at least able to generate previews for code purely written in Swift & Xcode.
While crashing, this is the crash log that the Xcode is giving me: https://pastebin.com/FemVAay4Andrew Reed
01/31/2023, 10:57 AMCould not create task ':firebase-app:linkPodDebugFrameworkIosArm64'.
> Could not create task of type 'KotlinNativeLink'.
> Configuration with name 'iosArm64PodDebugFrameworkExport' not found.
Target setup is the following:
ios {
binaries {
framework {
baseName = "FirebaseApp"
}
}
}
iosSimulatorArm64 {
binaries {
framework {
baseName = "FirebaseApp"
}
}
}
Im using cocoapods to fetch the dependancy for ios:
kotlin {
cocoapods {
ios.deploymentTarget = "11.0"
framework {
isStatic = true
}
noPodspec()
pod("FirebaseCore")
}
}
leandro
02/01/2023, 10:41 PMAndrew Reed
02/14/2023, 5:28 PMDaniele B
02/15/2023, 5:48 PMvar path : MutableList<ScreenIdentifier> = mutableListOf()
retrieving Binding Swift Array => successful! 🎉
extension Binding where Value == NSMutableArray {
public func cast() -> Binding<[ScreenIdentifier]> {
return Binding<[ScreenIdentifier]>(get:{ self.wrappedValue as NSArray as! [ScreenIdentifier] },
set: { self.wrappedValue = NSMutableArray(array: $0) })
}
}
===
NavigationStack(path: $path.cast()) {
...
}
===
=== Kotlin MutableMap of MutableList to binding Swift Array ===
Kotlin MutableMap of MutableLists definition:
var paths : MutableMap<String, MutableList<ScreenIdentifier>> = mutableMapOf(),
retrieving Binding Swift Array => not working 😩
extension Binding where Value == NSMutableDictionary {
public func getPath(level1URI: String) -> Binding<[ScreenIdentifier]> {
return Binding<[ScreenIdentifier]>(
get:{
let dict = self.wrappedValue as NSDictionary as! [String:[ScreenIdentifier]]
return dict[level1URI] as! NSMutableArray as NSArray as! [ScreenIdentifier]
},
set: {
var modifiedDict = self.wrappedValue as! [NSString:NSMutableArray]
modifiedDict[level1URI as NSString] = NSMutableArray(array: $0)
self.wrappedValue = NSMutableDictionary(dictionary: modifiedDict as! KotlinMutableDictionary<NSString,NSMutableArray>)
}
)
}
}
===
NavigationStack(path: $paths.getPath(level1URI: myString)) {
...
}
===
this is the error given by XCode:
Referencing instance method 'getPath(level1URI:)' on 'Binding' requires the types 'KotlinMutableDictionary<NSString, NSMutableArray>' and 'NSMutableDictionary' be equivalent
felix
02/23/2023, 2:59 PMpod_mycpplibrary
). To integrate the C++ library we created a cocoapod and want to use the cinterop with ObjectiveC for interoperability with kotlin.
The simplified build.gradle.kts
looks like:
plugins {
kotlin("native.cocoapods")
...
kotlin {
cocoapods {
version = "0.0.1"
summary = "my library"
homepage = ""
name = libName
ios.deploymentTarget = "13.5"
xcodeConfigurationToNativeBuildType["CUSTOM_DEBUG"] = NativeBuildType.DEBUG
xcodeConfigurationToNativeBuildType["CUSTOM_RELEASE"] = NativeBuildType.RELEASE
framework {
baseName = libName
isStatic = true
transitiveExport = true
}
pod("pod_mycpplibrary") {
version = "1.0"
headers = "foo.h"
source = path(project.file("../pod_mycpplibrary"))
}
useLibraries()
}
val xcFramework = XCFramework(libName)
val iosTargets = listOf(
iosArm64(),
iosSimulatorArm64()
)
iosTargets.forEach {
it.binaries{
framework {
baseName = libName
xcFramework.add(this)
}
}
}
sourceSets {
...
The folder strucure is as following:
• kmmproject
◦ mylib
▪︎ src
▪︎ build.gradle.kts
◦ pod_mycpplibrary
▪︎ src
▪︎ pod_mycpplibrary.podspec
◦ …
The pod can be successfully created with the command ./gradlew podPublishXCFramework
and can be found in ./mylib/build/cocoapods/publish/*
If a sample app is now using this library we always have to define both dependencies in the sample app in the Podfile.
target 'sample_app' do
pod 'mylib', :path => '/path/to/kmmproject/mylib/build/cocoapods/publish/debug'
pod 'pod_mycpplibrary', :path => '/path/to/kmmproject/mylib/pod_mycpplibrary'
end
Is there a way to build mylib
in a way that we do not need to provide pod_mycpplibrary
? pod_mycpplibrary
is already build as static lib (useLibraries
and isStatic=true
). Should this not be enough?
The generated podspec in the buildfolder also does not use https://guides.cocoapods.org/syntax/podspec.html#vendored_libraries
Is there a way to set this?
Or is there a better way to include a C++ library than using a pod with Objective C wrapper?
Thank you.Hasnain
02/24/2023, 7:59 AMCLOVIS
02/26/2023, 4:48 PMSlackbot
03/03/2023, 9:25 PMSlackbot
03/03/2023, 9:25 PMAndrei Salavei
03/06/2023, 9:44 AM