From f87b088a6a995bb7f264148ca7ba08212e1edeed Mon Sep 17 00:00:00 2001 From: Julien Von Der Marck <62793491+jvondermarck@users.noreply.github.com> Date: Tue, 10 Sep 2024 10:42:27 +0200 Subject: [PATCH 1/5] docs(native-cocoapods-xcode.md): remove deprecated code and information to make the pods installation works --- .../topics/multiplatform/native-cocoapods-xcode.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/topics/multiplatform/native-cocoapods-xcode.md b/docs/topics/multiplatform/native-cocoapods-xcode.md index 9e9e5643aaa..7597f8d38d4 100644 --- a/docs/topics/multiplatform/native-cocoapods-xcode.md +++ b/docs/topics/multiplatform/native-cocoapods-xcode.md @@ -39,9 +39,6 @@ dependency by calling `pod install` manually for each Xcode project. In other ca summary = "CocoaPods test library" homepage = "https://github.com/JetBrains/kotlin" iosArm64.deploymentTarget = "13.5" - pod("FirebaseAuth") { - version = "10.16.0" - } podfile = project.file("../ios-app/Podfile") } } @@ -56,12 +53,17 @@ dependency by calling `pod install` manually for each Xcode project. In other ca target 'ios-app' do pod 'kotlin_library', :path => '../kotlin-library' + pod 'FirebaseAuth', '~> 10.16.0' end ``` + +6. **Run `pod install`**: + - When you run `pod install` for the first time, it will create an `.xcworkspace` file. This file includes your original `.xcodeproj` and a Pods project. + - **Important**: Close your `.xcodeproj` and open the newly created `.xcworkspace` instead. This step is crucial to avoid issues with project dependencies. -6. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio) +7. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio) to re-import the project. - + ## Xcode project with several targets 1. Create an Xcode project with a `Podfile` if you haven't done so yet. @@ -117,4 +119,4 @@ You can find a sample project [here](https://github.com/Kotlin/kmm-with-cocoapod ## What's next See [Connect the framework to your iOS project](https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-integrate-in-existing-app.html#connect-the-framework-to-your-ios-project) -to learn how to add a custom build script to build phases in Xcode projects. \ No newline at end of file +to learn how to add a custom build script to build phases in Xcode projects. From d156c42fe8d3ba4f627df9038483a6be4302cdf8 Mon Sep 17 00:00:00 2001 From: Julien Von Der Marck <62793491+jvondermarck@users.noreply.github.com> Date: Thu, 12 Sep 2024 08:43:35 +0200 Subject: [PATCH 2/5] docs(native-cocoapods-xcode.md): re-add pod code in the build.gradle It was a mistake I made to remove it --- docs/topics/multiplatform/native-cocoapods-xcode.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/topics/multiplatform/native-cocoapods-xcode.md b/docs/topics/multiplatform/native-cocoapods-xcode.md index 7597f8d38d4..b7a8ac3428d 100644 --- a/docs/topics/multiplatform/native-cocoapods-xcode.md +++ b/docs/topics/multiplatform/native-cocoapods-xcode.md @@ -39,6 +39,9 @@ dependency by calling `pod install` manually for each Xcode project. In other ca summary = "CocoaPods test library" homepage = "https://github.com/JetBrains/kotlin" iosArm64.deploymentTarget = "13.5" + pod("FirebaseAuth") { + version = "10.16.0" + } podfile = project.file("../ios-app/Podfile") } } @@ -53,7 +56,6 @@ dependency by calling `pod install` manually for each Xcode project. In other ca target 'ios-app' do pod 'kotlin_library', :path => '../kotlin-library' - pod 'FirebaseAuth', '~> 10.16.0' end ``` From 41e0c834727dbd839608f434c5826bf16c867d07 Mon Sep 17 00:00:00 2001 From: "Danil.Pavlov" Date: Thu, 26 Sep 2024 16:18:15 +0200 Subject: [PATCH 3/5] fix: wording --- .../multiplatform/native-cocoapods-xcode.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/topics/multiplatform/native-cocoapods-xcode.md b/docs/topics/multiplatform/native-cocoapods-xcode.md index b7a8ac3428d..0fc520a10d8 100644 --- a/docs/topics/multiplatform/native-cocoapods-xcode.md +++ b/docs/topics/multiplatform/native-cocoapods-xcode.md @@ -40,8 +40,8 @@ dependency by calling `pod install` manually for each Xcode project. In other ca homepage = "https://github.com/JetBrains/kotlin" iosArm64.deploymentTarget = "13.5" pod("FirebaseAuth") { - version = "10.16.0" - } + version = "10.16.0" + } podfile = project.file("../ios-app/Podfile") } } @@ -58,14 +58,15 @@ dependency by calling `pod install` manually for each Xcode project. In other ca pod 'kotlin_library', :path => '../kotlin-library' end ``` - -6. **Run `pod install`**: - - When you run `pod install` for the first time, it will create an `.xcworkspace` file. This file includes your original `.xcodeproj` and a Pods project. - - **Important**: Close your `.xcodeproj` and open the newly created `.xcworkspace` instead. This step is crucial to avoid issues with project dependencies. -7. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio) +6. Run `pod install` in you project directory. + + When you run `pod install` for the first time, it creates the `.xcworkspace` file. This file + includes your original `.xcodeproj` and the CocoaPods project. +7. Close your `.xcodeproj` and open the new `.xcworkspace` file instead. This way you avoid issues with project dependencies. +8. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio) to re-import the project. - + ## Xcode project with several targets 1. Create an Xcode project with a `Podfile` if you haven't done so yet. From 32b2fcd0f3e1cf86085dbb7c71aa1a782e250f35 Mon Sep 17 00:00:00 2001 From: "Danil.Pavlov" Date: Mon, 30 Sep 2024 19:02:14 +0200 Subject: [PATCH 4/5] update: cocoapods setup additional info --- .../multiplatform/native-cocoapods-xcode.md | 7 ++- docs/topics/multiplatform/native-cocoapods.md | 53 ++++++++++--------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/docs/topics/multiplatform/native-cocoapods-xcode.md b/docs/topics/multiplatform/native-cocoapods-xcode.md index 0fc520a10d8..9757f110a00 100644 --- a/docs/topics/multiplatform/native-cocoapods-xcode.md +++ b/docs/topics/multiplatform/native-cocoapods-xcode.md @@ -114,7 +114,12 @@ dependency by calling `pod install` manually for each Xcode project. In other ca end ``` -6. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio) +6. Run `pod install` in you project directory. + + When you run `pod install` for the first time, it creates the `.xcworkspace` file. This file + includes your original `.xcodeproj` and the CocoaPods project. +7. Close your `.xcodeproj` and open the new `.xcworkspace` file instead. This way you avoid issues with project dependencies. +8. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio) to re-import the project. You can find a sample project [here](https://github.com/Kotlin/kmm-with-cocoapods-multitarget-xcode-sample). diff --git a/docs/topics/multiplatform/native-cocoapods.md b/docs/topics/multiplatform/native-cocoapods.md index aad8a2cca4d..9d27033680e 100644 --- a/docs/topics/multiplatform/native-cocoapods.md +++ b/docs/topics/multiplatform/native-cocoapods.md @@ -216,40 +216,45 @@ the build process of an Xcode project. ## Update Podfile for Xcode -If you want to import your Kotlin project in an Xcode project, you need to make some changes to your Podfile: +If you want to import your Kotlin project to an Xcode project: -* If your project has any Git, HTTP, or custom Podspec repository dependencies, you should also specify the path to -the Podspec in the Podfile. +1. Make changes in your Podfile: - For example, if you add a dependency on `podspecWithFilesExample`, declare the path to the Podspec in the Podfile: + * If your project has any Git, HTTP, or custom Podspec repository dependencies, you should also specify the path to + the Podspec in the Podfile. - ```ruby - target 'ios-app' do + For example, if you add a dependency on `podspecWithFilesExample`, declare the path to the Podspec in the Podfile: + + ```ruby + target 'ios-app' do # ... other dependencies ... - pod 'podspecWithFilesExample', :path => 'cocoapods/externalSources/url/podspecWithFilesExample' - end - ``` + pod 'podspecWithFilesExample', :path => 'cocoapods/externalSources/url/podspecWithFilesExample' + end + ``` - The `:path` should contain the filepath to the Pod. + The `:path` should contain the filepath to the Pod. -* When you add a library from the custom Podspec repository, you should also specify the [location](https://guides.cocoapods.org/syntax/podfile.html#source) -of specs at the beginning of your Podfile: + * When you add a library from the custom Podspec repository, you should also specify the [location](https://guides.cocoapods.org/syntax/podfile.html#source) + of specs at the beginning of your Podfile: - ```ruby - source 'https://github.com/Kotlin/kotlin-cocoapods-spec.git' + ```ruby + source 'https://github.com/Kotlin/kotlin-cocoapods-spec.git' - target 'kotlin-cocoapods-xcproj' do - # ... other dependencies ... - pod 'example' - end - ``` + target 'kotlin-cocoapods-xcproj' do + # ... other dependencies ... + pod 'example' + end + ``` -> After making changes in the Podfile, run **Reload All Gradle Projects** in IntelliJ IDEA -> (or **Sync Project with Gradle Files** in Android Studio) to re-import the project. -> -{style="note"} +2. Run `pod install` in you project directory. + + When you run `pod install` for the first time, it creates the `.xcworkspace` file. This file + includes your original `.xcodeproj` and the CocoaPods project. +3. Close your `.xcodeproj` and open the new `.xcworkspace` file instead. This way you avoid issues with project dependencies. +4. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio) + to re-import the project. -If you don't make these changes to the Podfile, the `podInstall` task will fail, and the CocoaPods plugin will show +If you don't make these changes in the Podfile, the `podInstall` task will fail, and the CocoaPods plugin will show an error message in the log. ## Possible issues and solutions From bbc7f2033b5bb0b057cc29d1f614591d5ce37de0 Mon Sep 17 00:00:00 2001 From: Danil Pavlov Date: Thu, 17 Oct 2024 11:30:06 +0200 Subject: [PATCH 5/5] fix: review suggestions Co-authored-by: Andrey Polyakov --- docs/topics/multiplatform/native-cocoapods.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/topics/multiplatform/native-cocoapods.md b/docs/topics/multiplatform/native-cocoapods.md index 9d27033680e..faa127dd0af 100644 --- a/docs/topics/multiplatform/native-cocoapods.md +++ b/docs/topics/multiplatform/native-cocoapods.md @@ -220,7 +220,7 @@ If you want to import your Kotlin project to an Xcode project: 1. Make changes in your Podfile: - * If your project has any Git, HTTP, or custom Podspec repository dependencies, you should also specify the path to + * If your project has any Git, HTTP, or custom Podspec repository dependencies, you should specify the path to the Podspec in the Podfile. For example, if you add a dependency on `podspecWithFilesExample`, declare the path to the Podspec in the Podfile: