XcodeでiOSアプリを開いて実行する
共有frameworkをリンクしたiOSアプリを起動します
「XcodeでiOSアプリを開いて実行する」はCoddyKit上の無料Kotlin Multiplatform Academyレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはKotlin Multiplatform Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Kotlin Multiplatform Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Now the iOS Side
Android worked, so let's light up iOS. The iOS app lives in its own folder and you build it with Xcode, not Android Studio. 🍎
Open the Xcode Project
Inside the iosApp folder you'll find a project or workspace file. Double-click it to open the iOS app in Xcode.
open iosApp/iosApp.xcodeprojWorkspace vs Project File
If your setup uses CocoaPods, always open the .xcworkspace file. The plain .xcodeproj will miss the pod dependencies.
Pick a Scheme and Simulator
At the top of Xcode, choose the iosApp scheme and a simulator like iPhone 15 from the device dropdown.
The Shared Framework Link
The iOS app does not consume Kotlin source directly. It links a precompiled framework that Gradle produces from your shared module.
A Build Phase Runs Gradle
A custom build phase in Xcode calls Gradle first. That step compiles the shared framework before Swift code is even touched.
./gradlew :shared:embedAndSignAppleFrameworkForXcodePress Run in Xcode
Click the Run triangle. Xcode triggers Gradle, builds the framework, compiles Swift, and boots the simulator with your app.
Call Shared Code from Swift
Your Swift screen imports the framework and calls the shared API by name. The same logic that ran on Android now runs on iOS.
import shared
let text = Greeting().greet()First Build Is the Slow One
The very first iOS build compiles the whole framework, so be patient. Later runs reuse cached output and feel much faster. ⏳
Read Errors in the Issue Navigator
When something fails, open the Issue Navigator. Gradle errors and Swift errors both surface here with a jump-to-line link.
Same Logic, Two Apps
Seeing your shared greeting in the iOS simulator closes the loop. One Kotlin codebase is now powering both native apps.
Quick Check
Let's confirm how iOS consumes your shared Kotlin.
Recap
You opened the iosApp in Xcode, picked a simulator, and pressed Run. A build phase ran Gradle to make the framework, then Swift called your shared code live. 🎉
よくある質問
「XcodeでiOSアプリを開いて実行する」レッスンは無料ですか?
はい。「XcodeでiOSアプリを開いて実行する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Kotlin Multiplatform Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Kotlin Multiplatform Academyコースには全4レッスンが含まれています。
「XcodeでiOSアプリを開いて実行する」で何を学びますか?
共有frameworkをリンクしたiOSアプリを起動します ブラウザで直接実行するハンズオンコードでKotlin Multiplatform Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Kotlin Multiplatform Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのKotlin Multiplatform Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。
「XcodeでiOSアプリを開いて実行する」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このKotlin Multiplatform Academyレッスンでコードを書いて実行できますか?
はい。すべてのKotlin Multiplatform Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- StudioからAndroidアプリを実行する
- XcodeでiOSアプリを開いて実行する
- iOS Frameworkのビルド方法
- 「共有コードが見つからない」問題をデバッグする