Skip to content

Commit c851be0

Browse files
authored
update: cocoapods setup add info (#4464)
1 parent 39c7796 commit c851be0

File tree

2 files changed

+42
-27
lines changed

2 files changed

+42
-27
lines changed

docs/topics/multiplatform/native-cocoapods-xcode.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ dependency by calling `pod install` manually for each Xcode project. In other ca
5959
end
6060
```
6161

62-
6. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio)
62+
6. Run `pod install` in you project directory.
63+
64+
When you run `pod install` for the first time, it creates the `.xcworkspace` file. This file
65+
includes your original `.xcodeproj` and the CocoaPods project.
66+
7. Close your `.xcodeproj` and open the new `.xcworkspace` file instead. This way you avoid issues with project dependencies.
67+
8. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio)
6368
to re-import the project.
6469

6570
## Xcode project with several targets
@@ -109,12 +114,17 @@ dependency by calling `pod install` manually for each Xcode project. In other ca
109114
end
110115
```
111116
112-
6. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio)
117+
6. Run `pod install` in you project directory.
118+
119+
When you run `pod install` for the first time, it creates the `.xcworkspace` file. This file
120+
includes your original `.xcodeproj` and the CocoaPods project.
121+
7. Close your `.xcodeproj` and open the new `.xcworkspace` file instead. This way you avoid issues with project dependencies.
122+
8. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio)
113123
to re-import the project.
114124
115125
You can find a sample project [here](https://github.com/Kotlin/kmm-with-cocoapods-multitarget-xcode-sample).
116126
117127
## What's next
118128

119129
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)
120-
to learn how to add a custom build script to build phases in Xcode projects.
130+
to learn how to add a custom build script to build phases in Xcode projects.

docs/topics/multiplatform/native-cocoapods.md

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -216,40 +216,45 @@ the build process of an Xcode project.
216216
217217
## Update Podfile for Xcode
218218
219-
If you want to import your Kotlin project in an Xcode project, you need to make some changes to your Podfile:
219+
If you want to import your Kotlin project to an Xcode project:
220220
221-
* If your project has any Git, HTTP, or custom Podspec repository dependencies, you should also specify the path to
222-
the Podspec in the Podfile.
221+
1. Make changes in your Podfile:
223222
224-
For example, if you add a dependency on `podspecWithFilesExample`, declare the path to the Podspec in the Podfile:
223+
* If your project has any Git, HTTP, or custom Podspec repository dependencies, you should specify the path to
224+
the Podspec in the Podfile.
225225
226-
```ruby
227-
target 'ios-app' do
226+
For example, if you add a dependency on `podspecWithFilesExample`, declare the path to the Podspec in the Podfile:
227+
228+
```ruby
229+
target 'ios-app' do
228230
# ... other dependencies ...
229-
pod 'podspecWithFilesExample', :path => 'cocoapods/externalSources/url/podspecWithFilesExample'
230-
end
231-
```
231+
pod 'podspecWithFilesExample', :path => 'cocoapods/externalSources/url/podspecWithFilesExample'
232+
end
233+
```
232234
233-
The `:path` should contain the filepath to the Pod.
235+
The `:path` should contain the filepath to the Pod.
234236
235-
* When you add a library from the custom Podspec repository, you should also specify the [location](https://guides.cocoapods.org/syntax/podfile.html#source)
236-
of specs at the beginning of your Podfile:
237+
* When you add a library from the custom Podspec repository, you should also specify the [location](https://guides.cocoapods.org/syntax/podfile.html#source)
238+
of specs at the beginning of your Podfile:
237239
238-
```ruby
239-
source 'https://github.com/Kotlin/kotlin-cocoapods-spec.git'
240+
```ruby
241+
source 'https://github.com/Kotlin/kotlin-cocoapods-spec.git'
240242
241-
target 'kotlin-cocoapods-xcproj' do
242-
# ... other dependencies ...
243-
pod 'example'
244-
end
245-
```
243+
target 'kotlin-cocoapods-xcproj' do
244+
# ... other dependencies ...
245+
pod 'example'
246+
end
247+
```
246248
247-
> After making changes in the Podfile, run **Reload All Gradle Projects** in IntelliJ IDEA
248-
> (or **Sync Project with Gradle Files** in Android Studio) to re-import the project.
249-
>
250-
{style="note"}
249+
2. Run `pod install` in you project directory.
250+
251+
When you run `pod install` for the first time, it creates the `.xcworkspace` file. This file
252+
includes your original `.xcodeproj` and the CocoaPods project.
253+
3. Close your `.xcodeproj` and open the new `.xcworkspace` file instead. This way you avoid issues with project dependencies.
254+
4. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio)
255+
to re-import the project.
251256
252-
If you don't make these changes to the Podfile, the `podInstall` task will fail, and the CocoaPods plugin will show
257+
If you don't make these changes in the Podfile, the `podInstall` task will fail, and the CocoaPods plugin will show
253258
an error message in the log.
254259
255260
## Possible issues and solutions

0 commit comments

Comments
 (0)