Skip to content

Demonstrating a multipurpose Kotlin Multiplatform and Swift Package audio player. RadioPlayer combines shared Kotlin logic with native implementations using ExoPlayer for Android and AVPlayer in Swift for iOS, showcasing the future potential of Kotlin Multiplatform packages.

Notifications You must be signed in to change notification settings

markst/radioplayer-kt

Repository files navigation

RadioPlayer

Demonstrating a multipurpose Kotlin Multiplatform and Swift Package audio player.

RadioPlayer combines shared Kotlin logic with native implementations using ExoPlayer for Android and AVPlayer in Swift for iOS, showcasing the future potential of Kotlin Multiplatform packages.

This repository demonstrates how a package can be structured to share implementation between:

  • Kotlin Android Package
  • Kotlin Android Multiplatform Package
  • Kotlin iOS Multiplatform Package
  • Swift Package

By leveraging the Gradle Plugin swift-klib-plugin for injecting Swift code into the Kotlin Multiplatform Mobile shared module, the iOS RadioPlayer implementation is native Swift code rather than using interpolation. This means we can serve the Swift code as its own independent Package.swift.

Multi-Purpose

This means one repository can serve as both a Kotlin Multiplatform Package and a Native Swift Package, rather than using interpolation and writing native iOS sourceset in Kotlin.

RadioPlayer Diagram

iOS Package

By leveraging the Gradle Plugin for injecting Swift code into the Kotlin Multiplatform Mobile shared module swift-klib-plugin, RadioPlayer is implemented as a native Swift package.

The iOS component can be developed and maintained independently using the Swift Package Manager, making it easier to manage native iOS code.

It can serve as a native iOS component:

Swift Package

Android Package

On Android, it utilizes ExoPlayer, a powerful and flexible media player.

Android Package

About

Demonstrating a multipurpose Kotlin Multiplatform and Swift Package audio player. RadioPlayer combines shared Kotlin logic with native implementations using ExoPlayer for Android and AVPlayer in Swift for iOS, showcasing the future potential of Kotlin Multiplatform packages.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published