Skip to content

Commit a719522

Browse files
authored
update: tldr blocks and pod dependency instructions (#4804)
1 parent 696f5ce commit a719522

7 files changed

+138
-94
lines changed

docs/topics/multiplatform/multiplatform-direct-integration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ To migrate from the CocoaPods plugin:
3737

3838
1. In Xcode, clean build directories using **Product** | **Clean Build Folder** or with the
3939
<shortcut>Cmd + Shift + K</shortcut> shortcut.
40-
2. In the directory with the `Podfile` file, run the following command:
40+
2. In the directory with the Podfile, run the following command:
4141

4242
```none
4343
pod deintegrate
4444
```
4545

4646
3. Remove the `cocoapods {}` block from your `build.gradle(.kts)` files.
47-
4. Delete the `.podspec` and `Podfile` files.
47+
4. Delete the `.podspec` file and the Podfile.
4848

4949
### Connect the framework to your project
5050

docs/topics/multiplatform/multiplatform-ios-dependencies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ Learn more about [Objective-C and Swift interop](native-objc-interop.md) and
251251
* [From a custom Podspec repository](native-cocoapods-libraries.md#from-a-custom-podspec-repository)
252252
* [With custom cinterop options](native-cocoapods-libraries.md#with-custom-cinterop-options)
253253

254-
3. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio)
254+
3. Run **Build** | **Reload All Gradle Projects** in IntelliJ IDEA (or **File** | **Sync Project with Gradle Files** in Android Studio)
255255
to re-import the project.
256256

257257
To use the dependency in your Kotlin code, import the package `cocoapods.<library-name>`. For the example above, it's:

docs/topics/multiplatform/multiplatform-spm-local-integration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ To migrate from the CocoaPods plugin:
6363

6464
1. In Xcode, clean build directories using **Product** | **Clean Build Folder** or with the
6565
<shortcut>Cmd + Shift + K</shortcut> shortcut.
66-
2. In the directory with `Podfile`, run the following command:
66+
2. In the directory with Podfile, run the following command:
6767

6868
```none
6969
pod deintegrate
7070
```
7171

7272
3. Remove the `cocoapods {}` block from your `build.gradle(.kts)` files.
73-
4. Delete the `.podspec` and `Podfile` files.
73+
4. Delete the `.podspec` file and the Podfile.
7474

7575
## Connect the framework to your project
7676

docs/topics/multiplatform/native-cocoapods-dsl-reference.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
[//]: # (title: CocoaPods Gradle plugin DSL reference)
22

3-
Kotlin CocoaPods Gradle plugin is a tool for creating Podspec files. These files are necessary to integrate your Kotlin
4-
project with the [CocoaPods dependency manager](https://cocoapods.org/).
3+
<tldr>
4+
5+
* Before adding Pod dependencies, [complete the initial configuration](native-cocoapods.md#set-up-an-environment-to-work-with-cocoapods).
6+
* See the sample project with [different Pod dependencies set up in a Kotlin project](https://github.com/Kotlin/kmp-with-cocoapods-multitarget-xcode-sample).
7+
* Check out the sample project where [an Xcode project with several targets depends on a Kotlin library](https://github.com/Kotlin/kmp-with-cocoapods-multitarget-xcode-sample).
8+
9+
</tldr>
510

6-
This reference contains the complete list of blocks, functions, and properties for the Kotlin CocoaPods Gradle plugin that
7-
you can use when working with the [CocoaPods integration](native-cocoapods.md).
11+
The Kotlin CocoaPods Gradle plugin is a tool for creating Podspec files. These files are necessary to integrate your Kotlin
12+
project with the [CocoaPods dependency manager](https://cocoapods.org/).
813

9-
* Learn how to [set up the environment and configure the Kotlin CocoaPods Gradle plugin](native-cocoapods.md).
10-
* Depending on your project and purposes, you can add dependencies between [a Kotlin project and a Pod library](native-cocoapods-libraries.md)
11-
as well as [a Kotlin Gradle project and an Xcode project](native-cocoapods-xcode.md).
14+
This DSL reference lists the main blocks, functions, and properties for the Kotlin CocoaPods Gradle plugin that
15+
you can use when setting up CocoaPods integration.
1216

1317
## Enable the plugin
1418

@@ -23,9 +27,9 @@ plugins {
2327

2428
The plugin versions match the [Kotlin release versions](releases.md). The latest stable version is %kotlinVersion%.
2529

26-
## cocoapods block
30+
## `cocoapods {}` block
2731

28-
The `cocoapods` block is the top-level block for the CocoaPods configuration. It contains general information on the Pod,
32+
The `cocoapods {}` block is the top-level block for the CocoaPods configuration. It contains general information on the Pod,
2933
including required information like the Pod version, summary, and homepage, as well as optional features.
3034

3135
You can use the following blocks, functions, and properties inside it:
@@ -36,7 +40,7 @@ You can use the following blocks, functions, and properties inside it:
3640
| `summary` | A required description of the Pod built from this project. |
3741
| `homepage` | A required link to the homepage of the Pod built from this project. |
3842
| `authors` | Specifies authors of the Pod built from this project. |
39-
| `podfile` | Configures the existing `Podfile` file. |
43+
| `podfile` | Configures the existing Podfile. |
4044
| `noPodspec()` | Sets up the plugin not to produce a Podspec file for the `cocoapods` section. |
4145
| `name` | The name of the Pod built from this project. If not provided, the project name is used. |
4246
| `license` | The license of the Pod built from this project, its type, and the text. |
@@ -88,9 +92,9 @@ kotlin {
8892
}
8993
```
9094

91-
### framework block
95+
### `framework {} block
9296

93-
The `framework` block is nested inside `cocoapods` and configures the framework properties of the Pod built from the project.
97+
The `framework {}` block is nested inside `cocoapods` and configures the framework properties of the Pod built from the project.
9498

9599
> Note that `baseName` is a required field.
96100
>
@@ -116,7 +120,7 @@ kotlin {
116120
}
117121
```
118122

119-
## pod() function
123+
## `pod()` function
120124

121125
The `pod()` function call adds a CocoaPods dependency to the Pod built from this project. Each dependency requires
122126
a separate function call.
@@ -153,3 +157,9 @@ kotlin {
153157
}
154158
}
155159
```
160+
161+
## What's next
162+
163+
* [See the full syntax of Kotlin DSL in the Kotlin Gradle plugin repository](https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/native/cocoapods/CocoapodsExtension.kt)
164+
* [Add dependencies on a Pod library in your Kotlin project](native-cocoapods-libraries.md)
165+
* [Set up dependencies between a Kotlin project and an Xcode project](native-cocoapods-xcode.md)

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

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
11
[//]: # (title: Add dependencies on a Pod library)
22

3-
To add dependencies between a Kotlin project and a Pod library, [complete the initial configuration](native-cocoapods.md#set-up-an-environment-to-work-with-cocoapods).
4-
You can then add dependencies on different types of Pod libraries.
3+
<tldr>
54

6-
When you add a new dependency and re-import the project in your IDE, the new dependency will be added automatically.
7-
No additional steps are required.
5+
* Before adding Pod dependencies, [complete the initial configuration](native-cocoapods.md#set-up-an-environment-to-work-with-cocoapods).
6+
* You can find a sample project in our [GitHub repository](https://github.com/Kotlin/kmp-with-cocoapods-sample).
87

9-
To use your Kotlin project with Xcode, you should [make changes in your project Podfile](native-cocoapods.md#update-podfile-for-xcode).
8+
</tldr>
109

11-
A Kotlin project requires the `pod()` function call in `build.gradle(.kts)` for adding a Pod dependency.
12-
Each dependency requires its separate function call. You can specify the parameters for the dependency in
10+
You can add dependencies on Pod libraries from different locations in your Kotlin project.
11+
12+
To add a Pod dependency, call the `pod()` function in the shared module's `build.gradle(.kts)` file.
13+
Each dependency requires a separate function call. You can specify the parameters for the dependency in
1314
the configuration block of the function.
1415

16+
* When you add a new dependency and re-import the project in your IDE, the library will be connected automatically.
17+
* To use your Kotlin project with Xcode, [make changes in your project's Podfile](native-cocoapods.md#update-podfile-for-xcode) first.
18+
1519
> If you don't specify the minimum deployment target version and a dependency Pod requires a higher deployment target,
16-
> you will get an error.
20+
> you'll get an error.
1721
>
1822
{style="note"}
1923

20-
You can find a sample project [here](https://github.com/Kotlin/kmm-with-cocoapods-sample).
21-
2224
## From the CocoaPods repository
2325

26+
To add a dependency on a Pod library located in the CocoaPods repository:
27+
2428
1. Specify the name of a Pod library in the `pod()` function.
2529

26-
In the configuration block, you can specify the version of the library using the `version` parameter. To use the latest
27-
version of the library, you can just omit this parameter altogether.
30+
In the configuration block, you can specify the version of the library using the `version` parameter.
31+
To use the latest version of the library, you can omit this parameter altogether.
2832

29-
> You can add dependencies on subspecs.
33+
> You can add dependencies on subspecs as well.
3034
>
3135
{style="note"}
3236

@@ -49,7 +53,7 @@ version of the library, you can just omit this parameter altogether.
4953
}
5054
```
5155

52-
3. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio)
56+
3. Run **Build** | **Reload All Gradle Projects** in IntelliJ IDEA (or **File** | **Sync Project with Gradle Files** in Android Studio)
5357
to re-import the project.
5458

5559
To use these dependencies from the Kotlin code, import the packages `cocoapods.<library-name>`:
@@ -60,12 +64,14 @@ import cocoapods.SDWebImage.*
6064

6165
## On a locally stored library
6266

67+
To add a dependency on a locally stored Pod library:
68+
6369
1. Specify the name of a Pod library in the `pod()` function.
6470

6571
In the configuration block, specify the path to the local Pod library: use the `path()` function in the `source` parameter value.
6672

6773
> You can add local dependencies on subspecs as well.
68-
> The `cocoapods` block can include dependencies to Pods stored locally and Pods from the CocoaPods repository at
74+
> The `cocoapods {}` block can include dependencies to Pods stored locally and Pods from the CocoaPods repository at
6975
> the same time.
7076
>
7177
{style="note"}
@@ -104,7 +110,7 @@ import cocoapods.SDWebImage.*
104110
>
105111
{style="note"}
106112

107-
3. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio)
113+
3. Run **Build** | **Reload All Gradle Projects** in IntelliJ IDEA (or **File** | **Sync Project with Gradle Files** in Android Studio)
108114
to re-import the project.
109115

110116
To use these dependencies from the Kotlin code, import the packages `cocoapods.<library-name>`:
@@ -117,6 +123,8 @@ import cocoapods.SDWebImage.*
117123

118124
## From a custom Git repository
119125

126+
To add a dependency on a Pod library located in the custom Git repository:
127+
120128
1. Specify the name of a Pod library in the `pod()` function.
121129

122130
In the configuration block, specify the path to the git repository: use the `git()` function in the `source` parameter value.
@@ -166,7 +174,7 @@ import cocoapods.SDWebImage.*
166174
}
167175
```
168176

169-
3. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio)
177+
3. Run **Build** | **Reload All Gradle Projects** in IntelliJ IDEA (or **File** | **Sync Project with Gradle Files** in Android Studio)
170178
to re-import the project.
171179

172180
To use these dependencies from the Kotlin code, import the packages `cocoapods.<library-name>`:
@@ -179,7 +187,9 @@ import cocoapods.CocoaLumberjack.*
179187

180188
## From a custom Podspec repository
181189

182-
1. Specify the HTTP address to the custom Podspec repository using the `url()` inside the `specRepos` block.
190+
To add a dependency on a Pod library located in the custom Podspec repository:
191+
192+
1. Specify the address of the custom Podspec repository using a `url()` call inside the `specRepos {}` block.
183193
2. Specify the name of a Pod library in the `pod()` function.
184194
3. Specify the minimum deployment target version for the Pod library.
185195

@@ -201,11 +211,11 @@ import cocoapods.CocoaLumberjack.*
201211
}
202212
```
203213

204-
4. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio)
214+
4. Run **Build** | **Reload All Gradle Projects** in IntelliJ IDEA (or **File** | **Sync Project with Gradle Files** in Android Studio)
205215
to re-import the project.
206216

207-
> To work correctly with Xcode, you should specify the location of specs at the beginning of your Podfile.
208-
> For example,
217+
> To work with Xcode, specify the location of specs at the beginning of your Podfile:
218+
>
209219
> ```ruby
210220
> source 'https://github.com/Kotlin/kotlin-cocoapods-spec.git'
211221
> ```
@@ -220,6 +230,8 @@ import cocoapods.example.*
220230

221231
## With custom cinterop options
222232

233+
To add a dependency on a Pod library using custom cinterop options:
234+
223235
1. Specify the name of a Pod library in the `pod()` function.
224236
2. In the configuration block, add the following options:
225237

@@ -252,7 +264,7 @@ import cocoapods.example.*
252264
}
253265
```
254266

255-
4. Run **Reload All Gradle Projects** in IntelliJ IDEA (or **Sync Project with Gradle Files** in Android Studio)
267+
4. Run **Build** | **Reload All Gradle Projects** in IntelliJ IDEA (or **File** | **Sync Project with Gradle Files** in Android Studio)
256268
to re-import the project.
257269

258270
To use these dependencies from the Kotlin code, import the packages `cocoapods.<library-name>`:
@@ -322,4 +334,9 @@ printImageInfo(loadImage())
322334

323335
If you haven't configured the correct dependencies between cinterops in this case,
324336
the code would be invalid because the `WebImage` type would be sourced from different cinterop files and, consequently,
325-
different packages.
337+
different packages.
338+
339+
## What's next
340+
341+
* [Set up dependencies between a Kotlin project and an Xcode project](native-cocoapods-xcode.md)
342+
* [See the full CocoaPods Gradle plugin DSL reference](native-cocoapods-dsl-reference.md)

0 commit comments

Comments
 (0)