-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding more information about cocoapods #80
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,34 @@ | ||
# Integrating with Existing iOS Projects | ||
|
||
There are two primary ways to add a KMP library to your existing iOS project: with or without Cocoapods. Because of | ||
its simplicity and ease-of-use, we recommend that you use Cocoapods. | ||
There are two primary ways to add a KMP library to your existing iOS project: with or without Cocoapods. Cocoapods is the much simpler method of adding your library. By generating a file in gradle you can easily insert your library into your iOS project without worrying about build phases or targets. It's simple and ease-of-use, and we recommend that you use Cocoapods. | ||
|
||
If you don't want to use Cocoapods to add a KMP library to your iOS project, then you can follow the steps in [this | ||
guide](https://play.kotlinlang.org/hands-on/Targeting%20iOS%20and%20Android%20with%20Kotlin%20Multiplatform/01_Introduction) from Jetbrains about how to add the library to your iOS project manually. | ||
|
||
If you don't have Cocoapods installed, then follow the instructions in their [official installation guide](https://guides.cocoapods.org/using/getting-started.html). | ||
|
||
## Cocoapods Overview | ||
|
||
Explaining all of cocoapods is not within the scope of this document, however a basic introduction could be helpful in understanding how to integrate Kotlin Native into your iOS Project. In short, cocoapods is a dependency manager which uses a `Podfile` to reference a list of dependencies, or `pods`, that are to be injected. Each `pod` has a reference spec document, or a `podspec`, which details the pods name, version, source, and other information. By using cocoapods, we can reference our shared library and have it directly injected into the iOS Project. | ||
|
||
|
||
## Cocoapods gradle Integration | ||
|
||
Starting with 1.3.30, gradle has added an integration that allows the Kotlin Native library to be referenced as a Cocoapods dependency (We are using this integration in the KaMP Kit and we recommend this method when using cocoapods). The integration adds a gradle task that generates a `podspec` that includes everything needed to be referenced by cocoapods. We are using the available cocoapods code block to customize our podspec, which is located in the `shared/build.gradle`. | ||
|
||
``` | ||
cocoapods { | ||
summary = "Common library for the KaMP starter kit" | ||
homepage = "https://github.com/touchlab/KaMPStarter" | ||
isStatic = false | ||
} | ||
``` | ||
Note that you need to apply the `org.jetbrains.kotlin.native.cocoapods` plugin. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As of #76, we're using a forked version of the plugin in here, because the official one always builds a static framework which doesn't allow for debugging. We should address that in here in addition to or instead of pointing to the official plugin. |
||
|
||
To generate the podspec, run the `podspec` command, or `./gradlew podspec`. This wil generate the podspec in the root library folder. | ||
|
||
For more detailed information about the integration, [see more here](https://kotlinlang.org/docs/reference/native/cocoapods.html) | ||
|
||
|
||
## Create Podfile | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gradle didnt make the integration. Kotlin/KMP did