Skip to content

Sample KMP implementation of MVP design pattern on Android and iOS

Notifications You must be signed in to change notification settings

jshvarts/KmpGithub

Repository files navigation

Documentation

Setting up iOS

  1. Integrate Cocoapods plugin for Kotlin Native

See shared/build.gradle for cocoapods plugin setup. Note that setting version is required:

// CocoaPods requires the podspec to have a version.
version = 1.0

Also note the kotlin.cocoapods { ... } block.

The Cocoapods plugin will automatically build frameworks for both debug and release variants. No need to run any custom gradlew tasks to pack for Xcode, scripts to run, etc.

If you get stuck, refer to this commit

Note: if you prefer to run Gradle tasks to pack framework for xcode instead, refer to these detailed instructions

  1. Run ./gradlew :shared:podspec from the root of the project to generate shared/shared.podspec which contains kotlin targets for iOS (this includes simulator and device).

  2. Create XCode project in iosApp

  3. Close XCode.

  4. Inside the new project created run pod init

  5. Edit the generated Podfile to point to the shared.podspec:

target 'KmpGithub' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for KmpGithub
  pod 'shared', :path => '../../shared'
end
  1. Run pod install inside the XCode project folder.

  2. Open the project in XCode by executing open <proj-name>.xcworkspace from your ios project root folder.

  3. Use import shared in your code and utilize shared Kotlin code from Swift! If there are any build errors, try building the project by running in iOS simulator.

About

Sample KMP implementation of MVP design pattern on Android and iOS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published