https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
ios
  • p

    Pat Teruel

    12/07/2022, 9:03 AM
    I know what a UIWebViewDelegate is
  • p

    Pat Teruel

    12/07/2022, 9:04 AM
    I'm just wondering why does it have to exist in the build? Is there any particular reason?
  • a

    Adrian Witaszak

    12/07/2022, 9:11 AM
    I work on improving the build time for generating the
    XCFramework,
    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?
    n
    k
    • 3
    • 5
  • r

    Robert Konczi

    12/07/2022, 2:15 PM
    Hi team, I’m starting with KMM in an existing iOS project (workspace), which already contains a shared XCFramework (Appcore) and a main application project (UI & other stuff). I want to integrate the KMM framework in both targets, but if I get it right the
    ./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?
    m
    • 2
    • 1
  • l

    leandro

    12/09/2022, 6:35 PM
    Apple is rewriting Foundation in Swift (https://www.swift.org/blog/future-of-foundation/). It seem like there will be an Objective-C compatibility layer, but it’s not clear how much this would impact Kotlin/Native.
    d
    c
    r
    • 4
    • 6
  • m

    marzelwidmer

    12/26/2022, 6:31 AM
    Hello I just start learning some iOS development (basically I am a Kotlin Spring Backend Dev) … https://www.jetbrains.com/objc/ I ask my self make it sense to start with AppCode I just saw
    AppCode is no longer available as a commercial product as of December 14, 2022.
  • u

    ursus

    12/29/2022, 10:49 AM
    everybody is saddened by that..
  • j

    Jon Bailey

    12/29/2022, 1:05 PM
    I've just tried updating to Kotlin 1.8.0 which was released today, and I get this error when building from Xcode
  • j

    Jon Bailey

    12/29/2022, 2:16 PM
    Hello, I've just tried updating to Kotlin 1.8.0 (from 1.7.2) which was released today, and I get this error when building from Xcode:
    Could 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 it
  • s

    Sean Howard

    01/05/2023, 11:08 AM
    Hey folks, not sure if many of you have used the
    touchlab/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!
    k
    t
    +2
    • 5
    • 11
  • a

    andrea.degaetano

    01/05/2023, 2:37 PM
    Hello everyone! I already tried to look into this channel.. but I didn't find what I was looking for.. so we are trying to build a very simple KMM library to be shared on one native app we are developing. We started from android studio and created a new project from the template available for KMM library. Than we tried to import manually the library created in a basic IOS app... and it worked 😒uccess-baby: Later we spent some days trying to make this library available on our private cocoapod repository.. but with no success 😒ad-panda: Is there an official procedure to follow to publish the library into a cocoapod repository in order to make it available as a library for an xcode app? Or there is a better way to handle this kind of scenario? Thanks you
    l
    r
    • 3
    • 7
  • l

    Landry Norris

    01/06/2023, 9:29 PM
    I’m using a KMM library that declares a pod in it’s build.gradle.kts for iOS, and I’m having trouble running tests on the module that uses the library. If I don’t include
    pod("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?
    a
    k
    • 3
    • 8
  • c

    Calogero

    01/09/2023, 8:59 AM
    Hey guys! I’m working on porting an existing iOS app to Kotlin Multiplatform Mobile and I’m struggling in figuring out how to integrate Datadog with Ktor. I see Datadog provides a Java library, that cannot be used in the shared module of my app. I then thought of passing to the shared kotlin code an instance of DDURLSessionDelegate, which is the delegate responsible for tracing automatically every call performed through an URLSession on iOS. But unfortunately, with Ktor 2.2.1 is not possible anymore to pass a custom session with a custom delegate as a preconfigured Darwin session. The only doable thing is to create instance of KtorNSURLSessionDelegate, that is a completely sealed class. Do you have any suggestion? I’ll give more detail if needed :) Any help will be really appreciated! Thanks
  • j

    Jan Kuchař

    01/13/2023, 5:55 PM
    Anyone who is able to debug (e.g. stop on line) the KMM code from the iOS simulator? I’m having hard times. Tried Android Studio and Xcode, both with negative results. If you have any experiences, please share them in thread in #kotlin-native https://kotlinlang.slack.com/archives/C3PQML5NU/p1673631195903349 Thanks a lot! 🙏
  • a

    andylamax

    01/16/2023, 8:47 AM
    I currently don't have a mac with me to experiment, and I can't seem to find these answers online. I know that a
    List
    (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 documentation
    k
    l
    • 3
    • 5
  • l

    Landry Norris

    01/18/2023, 6:58 PM
    Has anyone taken a look at using Gradle Swift build in conjunction with KMM? Could this be helpful when pure Swift dependencies are needed? I’m thinking there has to be an easy way to do the traditional Kotlin interface implemented by Swift, where the library can handle creating the Swift class. The main challenge here is that the Swift framework would have to depend on the Kotlin framework to get the interface, but the Kotlin framework would have to depend on the Swift framework to get the class that implements the interface.
  • h

    Hakan

    01/20/2023, 7:10 AM
    Hi everyone I need to add new modules (
    iosArm64Main
    ,
    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*_
    r
    • 2
    • 5
  • d

    Daniele B

    01/23/2023, 8:53 PM
    I am running a KMM project. I get this error, but I am not sure how to fix it:
    Cannot 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.
    • 1
    • 2
  • s

    Shubham Singh

    01/26/2023, 12:54 PM
    Hey everyone So I'm working on a KMP project where the
    ios
    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:
  • l

    Landry Norris

    01/26/2023, 7:32 PM
    I have a kotlin module that pulls in a cocoapods library for iOS. When I try to add a macos target to this module, the cocoapods plugin is trying to get the pod for macos as well. This specific cocoapod does not support macos (though there is one that does). Is there a good way to specify that certain pods are for iOS only?
  • f

    Foso

    01/27/2023, 5:02 PM
    Is there any compiler plugin that does something like JvmOverloads for Objective-c?
  • s

    Shubham Singh

    01/30/2023, 11:31 AM
    Hey everyone Xcode is not able to generate previews and crashes as soon as I write any code from the
    shared
    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/FemVAay4
    j
    • 2
    • 2
  • a

    Andrew Reed

    01/31/2023, 10:57 AM
    Im trying to upgrade an existing project to kotlin 1.8.0 and im getting this issue:
    Could 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")
            }
        }
    j
    • 2
    • 4
  • l

    leandro

    02/01/2023, 10:41 PM
    Is it possible to somehow use cocoapods gradle plugin to import some Objc dependencies and use it in my common code, and do not export the cocoapods dependency down to the iOS app?
    a
    a
    • 3
    • 11
  • a

    Andrew Reed

    02/14/2023, 5:28 PM
    is there a roadmap for KMM native? Are there plans to support Pure Swift imports via the cocoapods plugin?
    l
    • 2
    • 6
  • d

    Daniele B

    02/15/2023, 5:48 PM
    I was able to retrieve a binding Swift Array from a Kotlin MutableList source, but I can’t find the way to retrieve a binding Swift Array from a Kotlin MutableMap of MutableLists source, given the map key. === Kotlin MutableList to binding Swift Array === Kotlin MutableList definition:
    var 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
    • 1
    • 1
  • f

    felix

    02/23/2023, 2:59 PM
    Hi, I am developing a kotlin multiplatform mobile library for iOS and Android. On iOS the KMM library should use some functionality provided in a C++ library (
    pod_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.
  • h

    Hasnain

    02/24/2023, 7:59 AM
    i have a question about Native UX for IOS development using KMM? Is XCode still necessary for the screens or can it all be done in android studio?
    d
    l
    k
    • 4
    • 5
  • c

    CLOVIS

    02/26/2023, 4:48 PM
    Hi! I am developing a Kotlin Multiplatform library (if you're curious: #decouple). A contributor is planning on introducing iOS support for it. I myself have no knowledge of iOS development (but I'm quite familiar with Kotlin multiplatform itself, mainly JVM and JS). I'm not worried about the Gradle setup, but I am worried about my ability of checking features and avoiding regressions. From what I've heard (again, my knowledge of the Apple world is near zero), it's not possible to compile an iOS library without an MacOS machine. Is it true? Is it the case even through Docker? I do not have a MacOS machine, I only run Linux variants. If that's the case, how can I test changes contributed to the library?
    m
    f
    +4
    • 7
    • 7
  • s

    Slackbot

    03/03/2023, 9:25 PM
    This message was deleted.
    a
    • 2
    • 1
Powered by Linen
Title
s

Slackbot

03/03/2023, 9:25 PM
This message was deleted.
a

Andrei Salavei

03/06/2023, 9:44 AM
Hi, it looks like your print functions just cuts the number.. Doubles in Swift contain much more digits in the decimal part then 8. If the output is not an issue - check what types you are using. You need 64 bit (8 byte) floating types,.
View count: 8