فتح تطبيق iOS وتشغيله في Xcode
تشغيل تطبيق iOS المرتبط بإطاركم المشترك
فتح تطبيق iOS وتشغيله في Xcode درس مجاني في Kotlin Multiplatform Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في 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. 🎉
الأسئلة الشائعة
هل درس «فتح تطبيق iOS وتشغيله في Xcode» مجاني؟
نعم — نص درس «فتح تطبيق iOS وتشغيله في Xcode» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Kotlin Multiplatform Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Kotlin Multiplatform Academy 4 دروس في المجموع.
ماذا ستتعلم في «فتح تطبيق iOS وتشغيله في Xcode»؟
تشغيل تطبيق iOS المرتبط بإطاركم المشترك تتمرن على Kotlin Multiplatform Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Kotlin Multiplatform Academy؟
لا تُشترط خبرة سابقة. Kotlin Multiplatform Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.
كم من الوقت يستغرق درس «فتح تطبيق iOS وتشغيله في Xcode»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Kotlin Multiplatform Academy هذا؟
نعم. كل درس في Kotlin Multiplatform Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- تشغيل تطبيق Android من Studio
- فتح تطبيق iOS وتشغيله في Xcode
- كيفية إنشاء إطار iOS
- تصحيح مشكلات 'Shared Code Not Found'