0Pricing
Kotlin Multiplatform Academy · Lezione

Aprire ed eseguire l'app iOS in Xcode

Avviare l'app iOS che collega il framework condiviso

Aprire ed eseguire l'app iOS in Xcode è una lezione Kotlin Multiplatform Academy gratuita su CoddyKit. Questa è la lezione 2 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Kotlin Multiplatform Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Kotlin Multiplatform Academy include 4 lezioni in totale.

Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.

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.xcodeproj

Workspace 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:embedAndSignAppleFrameworkForXcode

Press 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. 🎉

Domande Frequenti

La lezione «Aprire ed eseguire l'app iOS in Xcode» è gratuita?

Sì — il testo completo di «Aprire ed eseguire l'app iOS in Xcode» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Kotlin Multiplatform Academy, passa a CoddyKit PRO. Il corso Kotlin Multiplatform Academy include 4 lezioni in totale.

Cosa imparerò in «Aprire ed eseguire l'app iOS in Xcode»?

Avviare l'app iOS che collega il framework condiviso Eserciti Kotlin Multiplatform Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.

Ho bisogno di esperienza per iniziare Kotlin Multiplatform Academy?

Non è richiesta alcuna esperienza precedente. Kotlin Multiplatform Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 2 di 4.

Quanto tempo richiede la lezione «Aprire ed eseguire l'app iOS in Xcode»?

La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.

Posso scrivere ed eseguire codice in questa lezione Kotlin Multiplatform Academy?

Sì. Ogni lezione Kotlin Multiplatform Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.

Tutte le lezioni di questo corso

  1. Eseguire l'app Android da Studio
  2. Aprire ed eseguire l'app iOS in Xcode
  3. Come viene creato il framework iOS
  4. Risolvere i problemi "Shared Code Not Found"
← Torna a Kotlin Multiplatform Academy