swiftui-screen

Bridge SwiftUI screens with Kotlin Multiplatform ViewModels using StateFlow and SKIE interop.

1|Updated Nov 26, 2025
One-click install
npx skills add https://github.com/niltsiar/kotlin_multiplatform_pokedex --skill swiftui-screen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swiftui-screen
Source: https://github.com/niltsiar/kotlin_multiplatform_pokedex/tree/main/.agents/swiftui-screen
Command: npx skills add https://github.com/niltsiar/kotlin_multiplatform_pokedex --skill swiftui-screen

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Native iOS UI development with SwiftUI often duplicates complicated, platform-specific logic that could be shared across targets. This skill enables building screens backed by Kotlin Multiplatform ViewModels, ensuring StateFlow-driven UI and lifecycle coordination to be implemented once and reused across Android, iOS, and other targets.

Core Features & Use Cases

  • Direct SwiftUI integration with KMP ViewModels for non-parametric screens.
  • Parametric ViewModel support with ID-based screens and mock data for previews.
  • StateFlow bridging to SwiftUI using @State wrappers and .task-based observation.
  • SwiftUI Previews with Mock ViewModels for rapid visual testing.

Quick Start

Create a SwiftUI screen that consumes a KMP ViewModel using Direct Integration for non-parametric data or the parametric pattern for screens requiring parameters.

Frequently Asked Questions about swiftui-screen

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I integrate Kotlin Multiplatform ViewModels with SwiftUI?

You can integrate KMP ViewModels with SwiftUI by consuming StateFlow through @State wrappers and .task-based observation. This setup bridges shared Kotlin MVVM business logic to native iOS screens, managing lifecycle events across onAppear and onDisappear.

Can I pass parameters to a KMP ViewModel in a SwiftUI screen?

Yes, parametric ViewModels are supported using ID-based screens and Koin helpers. You can instantiate ViewModels with specific parameters and supply mock data to enable SwiftUI Previews for rapid visual testing.

How does StateFlow bridging work in SwiftUI?

StateFlow bridging uses @State wrappers and .task-based observation to feed Kotlin StateFlow values into SwiftUI views. This pattern ensures the UI reacts to shared state changes emitted from the Kotlin Multiplatform ViewModel.

Do I need SKIE interop patterns to use Kotlin Multiplatform ViewModels in iOS?

Yes, SKIE interop patterns are required to bridge SwiftUI with Kotlin Multiplatform ViewModels. They facilitate safe Kotlin-Swift type conversions, such as mapping Kotlin Int32 to Swift Int within the Shared framework.

Can I use SwiftUI Previews with shared Kotlin ViewModels?

Yes, SwiftUI Previews are supported by using mock ViewModels that provide mock data. This allows you to rapidly test and visualize parametric screens during iOS development without relying on live shared business logic.