https://kotlinlang.org logo
#compose-ios
Title
# compose-ios
a

Alex Styl

03/19/2024, 10:29 AM
Is there a way to run my Compose Multiplatform app on my iphone (real device) from Android Studio? I can only see simulators as potential targets via the 'Execution Targets' dropdown, so I guess not, but maybe someone has found a way
a

Arkadii Ivanov

03/19/2024, 10:45 AM
I haven't tried it myself, but one of the contributors added these files to my template exactly for this purpose: https://github.com/arkivanov/decompose-multiplatform-template/tree/master/.run
a

Alex Styl

03/19/2024, 10:47 AM
never seen
.run
before. what is it?
a

Arkadii Ivanov

03/19/2024, 10:48 AM
I think those files are created when you add run configurations manually.
a

Alex Styl

03/19/2024, 10:49 AM
TIL. I copy pasted the files to my project and it added configs. Values seem hardcoded so it doesnt work on my case but i think i can figure it out
👍 1
a

Arkadii Ivanov

03/19/2024, 10:53 AM
Yeah, you will likely need to change some values.
a

Alex Styl

03/19/2024, 10:57 AM
hmm cant get it to work. I am getting
Project directory '/Users/alexstyl/Downloads/KotlinProject/iosApp' is not part of the build defined by settings file '/Users/alexstyl/Downloads/KotlinProject/settings.gradle.kts'. If this is an unrelated build, it must have its own settings file.
which is weird, because in your project your ios app is also not defined in the settings.gradle.kts
getting the same when i closed your template
a

Arkadii Ivanov

03/19/2024, 11:18 AM
Right, sorry for the confusion! I think those files became outdated after migration to Xcode-based projects.
a

Alex Styl

03/19/2024, 11:37 AM
it's cool. i appreciate the pointer. i havent touched compose multiplatform in forever so i have no idea at what state it is currently (or what xcode based projects are)
a

Arkadii Ivanov

03/19/2024, 11:53 AM
A while ago, there was a way of creating a Compose iOS app without a single line in Swift, even without creating an Xcode project. There was a Gradle DSL like as follows.
Copy code
compose.experimental { 
    uikit.application { ... }
}
It allowed running the iOS app via a single Gradle task called
iosDeployIPhone12ProDebug
, which you can see in that run configuration file. But the support was removed and I think now we have to create an Xcode project and use
ComposeUIViewController
. See: https://kotlinlang.slack.com/archives/C0346LWVBJ4/p1699707606789959
👀 1
I think there should be a way of running the Xcode app from command line, and it should be possible to create a run configuration calling that command.
g

Garret Yoder

03/19/2024, 1:34 PM
You could also try running the project on your phone from xcode itself, that might at least generate some config files you can then use from Studio
xcode will build it and run last i tried it'll just act weird and throw a lot of errors/warns.
a

Alex Styl

03/19/2024, 1:51 PM
i can run it on xcode. havent figured out how from AS
6 Views