If you want to reuse your Kotlin business logic on Apple TV, you can. As of 2026, Kotlin Multiplatform supports tvOS as a Kotlin/Native target, so the same shared module that powers your iOS and Android apps can also drive a tvOS app. Compose Multiplatform does not officially target tvOS, so the TV UI stays native (SwiftUI or UIKit) and consumes the shared framework. To show how the pieces fit, I built a small sample repository, KMP-for-AppleTV.
I first published this post in 2024, and the ecosystem has moved since then, so I have rewritten it to reflect how sharing Kotlin code with tvOS actually looks now, and what is realistic to expect from the setup.
What is KMP-for-AppleTV?
KMP-for-AppleTV is a sample project that demonstrates how to use Kotlin Multiplatform to build applications for Apple TV. The goal of the repository is to give you a clear, minimal example of wiring a shared Kotlin module into a tvOS app, so you can see where the shared code lives, how it gets compiled into an Apple framework, and how the native TV layer calls into it.

At a glance, the repository gives you:
- Write business logic once and share it across iOS, Android, and Apple TV.
- Clone the project and get a tvOS build running without hunting for missing wiring.
- The on-screen layer is written natively for tvOS and talks to the Kotlin framework, which is the realistic split today.
- The commit that adds the KMP framework to the Xcode project is linked below, so you can reproduce it in your own app.
What can you actually share on tvOS?
Kotlin/Native compiles your shared module into an Apple framework, and tvOS is one of its supported targets (tvosArm64 for a device, tvosX64 and tvosSimulatorArm64 for the simulator). That means everything you would normally put in commonMain, such as networking, data models, parsing, validation, and business rules, compiles and runs on Apple TV the same way it does on iPhone.
What does not come along for free is the UI. Compose Multiplatform targets iOS and does not officially target tvOS as of 2026. Apple TV also has its own interaction model built around focus and the Siri Remote, which does not map cleanly onto a phone layout anyway. So the pragmatic architecture is the one this sample uses: keep the logic in Kotlin, and write the TV screens natively in SwiftUI or UIKit, calling into the generated framework. You share the expensive, testable part and leave the platform-specific part where it belongs.
Why would you use Kotlin Multiplatform for Apple TV?
If you already ship an iOS or Android app and you are adding a TV experience, KMP earns its place for a few concrete reasons:
- Your networking, models, and business rules already exist in
commonMain. Adding a tvOS target reuses that work instead of reimplementing it in Swift. - The TV app and the phone app resolve the same data the same way, which cuts down on the subtle discrepancies you get when two codebases drift apart.
- The shared logic has one set of unit tests. The TV app only has to cover its own UI and navigation, not the domain rules underneath.
The honest counterpoint: if your TV app is trivial or has almost nothing in common with your mobile app, the framework wiring may cost more than it saves. KMP pays off when there is real shared logic to reuse.
How to set up KMP for Apple TV
Here are the steps to get the sample running end to end.
- Clone the repository:
git clone https://github.com/davthecodercom/KMP-for-AppleTV.git
cd KMP-for-AppleTV
- Open the project in your preferred IDE (IntelliJ IDEA or Android Studio) so Gradle can sync the
sharedmodule and its tvOS target. - Set up the Apple TV environment: make sure you have Xcode installed, then open the
iosAppproject in Xcode and select the Apple TV target and a tvOS simulator (or a paired physical device). - Build and run: build the app in Xcode against an Apple TV simulator or device. The build compiles the Kotlin
sharedmodule into a framework and links it into the tvOS app, so your first run also verifies that the shared code compiles for tvOS.
What changes did I make to the Xcode project?
Teaching Xcode about the Kotlin framework is the fiddly part, so I isolated that into a single commit. You can follow it to see exactly what needs to change to add KMP into an Xcode project for Apple TV:
https://github.com/davthecodercom/KMP-for-AppleTV/commit/897eaefa49da84d6de64b92e701bc5119f4ff929
Reading the diff is the fastest way to understand the integration, because it shows the build settings and the framework link in context rather than as prose you have to translate back into Xcode.
How is the code structured?
The repository is organised into the following modules:
shared: the shared business logic and data models compiled into an Apple framework.iosApp: the Apple TV specific code and native UI./shared/src/commonMain/kotlincontains the shared code that every platform uses./shared/src/iosMain/kotlincontains the iOS-specific code./shared/src/tvosMain/kotlincontains the tvOS-specific code.
The tvosMain source set is where you put anything that has to differ for the TV target while still being written in Kotlin, and it sits alongside iosMain rather than replacing it. Anything platform-neutral stays in commonMain and is picked up by all of them.
I welcome contributions to the KMP-for-AppleTV project. If you have suggestions, bug fixes, or enhancements, please open an issue or submit a pull request. Feedback is what keeps the sample useful as the tooling changes.
Happy coding.
David Cruz davthecoder.com
Si quieres reutilizar tu lógica de negocio de Kotlin en Apple TV, puedes. A fecha de 2026, Kotlin Multiplatform admite tvOS como destino de Kotlin/Native, de modo que el mismo módulo compartido que da vida a tus apps de iOS y de Android también puede mover una app de tvOS. Compose Multiplatform no tiene tvOS como destino oficial, así que la interfaz de la tele se queda en nativo (SwiftUI o UIKit) y consume el framework compartido. Para enseñar cómo encajan las piezas, monté un repositorio de ejemplo pequeño, KMP-for-AppleTV.
Publiqué este artículo por primera vez en 2024, y el ecosistema se ha movido desde entonces, así que lo he reescrito para reflejar cómo se ve ahora, de verdad, compartir código Kotlin con tvOS, y qué es realista esperar de esta configuración.
¿Qué es KMP-for-AppleTV?
KMP-for-AppleTV es un proyecto de ejemplo que muestra cómo usar Kotlin Multiplatform para construir aplicaciones para Apple TV. El objetivo del repositorio es darte un ejemplo claro y mínimo de cómo enchufar un módulo Kotlin compartido en una app de tvOS, para que veas dónde vive el código compartido, cómo se compila hasta convertirse en un framework de Apple y cómo la capa nativa de la tele llama a ese framework.

A simple vista, el repositorio te ofrece:
- Escribes la lógica de negocio una vez y la compartes entre iOS, Android y Apple TV.
- Puedes clonar el proyecto y tener una compilación de tvOS en marcha sin tener que buscar el cableado que falta.
- La capa que se ve en pantalla está escrita de forma nativa para tvOS y habla con el framework de Kotlin, que es el reparto realista a día de hoy.
- El cambio exacto que añade el framework de KMP al proyecto de Xcode está enlazado más abajo, para que puedas reproducirlo en tu propia app.
¿Qué puedes compartir de verdad en tvOS?
Kotlin/Native compila tu módulo shared en un framework de Apple, y tvOS es uno de sus destinos admitidos (tvosArm64 para un dispositivo, tvosX64 y tvosSimulatorArm64 para el simulador). Eso significa que todo lo que normalmente meterías en commonMain, como la red, los modelos de datos, el parseo, la validación y las reglas de negocio, compila y se ejecuta en Apple TV igual que en el iPhone.
Lo que no viene de regalo es la interfaz. Compose Multiplatform tiene como destino iOS y no tiene tvOS como destino oficial a fecha de 2026. Apple TV, además, tiene su propio modelo de interacción, construido alrededor del foco y del Siri Remote, que de todos modos no encaja con limpieza en una maquetación de teléfono. Así que la arquitectura pragmática es la que usa este ejemplo: deja la lógica en Kotlin y escribe las pantallas de la tele de forma nativa, en SwiftUI o en UIKit, llamando al framework generado. Compartes la parte cara y la que se puede testear, y dejas la parte específica de la plataforma en el sitio que le corresponde.
¿Por qué usarías Kotlin Multiplatform para Apple TV?
Si ya publicas una app de iOS o de Android y estás añadiendo una experiencia de tele, KMP se gana el sitio por unos motivos concretos:
- Tu red, tus modelos y tus reglas de negocio ya existen en
commonMain. Añadir un destino tvOS reaprovecha ese trabajo, en lugar de volver a implementarlo en Swift. - La app de la tele y la del móvil resuelven los mismos datos de la misma manera, lo que recorta las discrepancias sutiles que aparecen cuando dos codebases se van separando.
- La lógica compartida tiene un único conjunto de tests unitarios. La app de la tele solo tiene que cubrir su propia interfaz y su navegación, no las reglas de dominio que hay debajo.
El contrapunto, dicho con honestidad: si tu app de tele es trivial, o casi no tiene nada en común con tu app móvil, el cableado del framework puede costarte más de lo que te ahorra. KMP compensa cuando hay lógica compartida de verdad que reutilizar.
Cómo configurar KMP para Apple TV
Estos son los pasos para poner el ejemplo en marcha de principio a fin.
- Clona el repositorio:
git clone https://github.com/davthecodercom/KMP-for-AppleTV.git
cd KMP-for-AppleTV
- Abre el proyecto en el IDE que prefieras (IntelliJ IDEA o Android Studio), para que Gradle sincronice el módulo
sharedy su destino tvOS. - Prepara el entorno de Apple TV: asegúrate de tener Xcode instalado, abre después el proyecto
iosAppen Xcode y selecciona el destino de Apple TV y un simulador de tvOS (o un dispositivo físico emparejado). - Compila y ejecuta: compila la app en Xcode contra un simulador o un dispositivo de Apple TV. La compilación convierte el módulo Kotlin
shareden un framework y lo enlaza dentro de la app de tvOS, así que esa primera ejecución también comprueba que el código compartido compila para tvOS.
¿Qué cambios hice en el proyecto de Xcode?
Enseñarle a Xcode dónde está el framework de Kotlin es la parte engorrosa, así que lo aislé en un único commit. Puedes seguirlo para ver, con exactitud, qué hay que cambiar para meter KMP en un proyecto de Xcode orientado a Apple TV:
https://github.com/davthecodercom/KMP-for-AppleTV/commit/897eaefa49da84d6de64b92e701bc5119f4ff929
Leer el diff es la vía más rápida de entender la integración, porque muestra los ajustes de compilación y el enlace del framework en su contexto, y no como prosa que luego tienes que volver a traducir a Xcode.
¿Cómo está estructurado el código?
El repositorio se organiza en los siguientes módulos:
shared: la lógica de negocio compartida y los modelos de datos, compilados en un framework de Apple.iosApp: el código específico de Apple TV y la interfaz nativa./shared/src/commonMain/kotlincontiene el código compartido que usa cada plataforma./shared/src/iosMain/kotlincontiene el código específico de iOS./shared/src/tvosMain/kotlincontiene el código específico de tvOS.
El source set tvosMain es donde colocas cualquier cosa que tenga que diferir en el destino de tele y que, aun así, esté escrita en Kotlin, y se sienta al lado de iosMain en lugar de sustituirlo. Todo lo que sea neutro respecto a la plataforma se queda en commonMain, y lo recogen todos ellos.
Acepto contribuciones al proyecto KMP-for-AppleTV. Si tienes sugerencias, correcciones de fallos o mejoras, abre una issue o envía un pull request. Los comentarios son lo que mantiene útil el ejemplo a medida que cambian las herramientas.
¡Feliz programación!
David Cruz davthecoder.com
Loading comments…Cargando comentarios…