Repository navigation
Releases
v0.4.0
Changed (breaking)
systemImageandsystemNameparameters take anSFSymbolinstead of aString. Constants are generated for
every SF Symbol (SFSymbol.starFill, with availability in their KDoc);SFSymbol("name")covers custom or newer
symbols. Migrate withsystemImage = "star.fill"→systemImage = SFSymbol.starFill.SwiftUIEnvironmentexposesColorScheme,DynamicTypeSize,UserInterfaceSizeClassandLayoutDirection
instead of strings. An absent size class is nownull(it used to be an empty string).
Added
LabelandContentUnavailableViewoverloads that take an asset-catalogimagewith aLocalizedKeytitle. They
used to clash with thesystemImageoverloads.
Fixed
renderComposeSwiftUIPreviewslinks static frameworks that use C libraries, such as SQLDelight's SQLite driver.
It passes the framework'slinkerOptsto the preview host and strips dead code like Xcode does. If symbols are
still missing, the error says to declare those libraries withlinkerOpts.
Install with the Gradle plugin in your shared KMP module:
plugins {
id("dev.nucleusframework.compose-swiftui") version "0.4.0"
}Library: dev.nucleusframework:compose-swiftui:0.4.0 on Maven Central.
Gradle plugin: dev.nucleusframework.compose-swiftui 0.4.0 on the Gradle Plugin Portal.
IDE plugin (previews in IntelliJ IDEA / Android Studio): download the zip below, then
Settings › Plugins › ⚙ › Install Plugin from Disk.
Full Changelog: v0.3.2...v0.4.0
v0.3.2
Fixed
renderComposeSwiftUIPreviewsworks with the configuration cache in modules that use Compose Multiplatform
resources. It used to fail with "cannot serialize object of type AssembleTargetResourcesTask".- The IntelliJ plugin asks for an IDE restart after it is installed. Without the restart, the previews stayed blank.
Install with the Gradle plugin in your shared KMP module:
plugins {
id("dev.nucleusframework.compose-swiftui") version "0.3.2"
}Library: dev.nucleusframework:compose-swiftui:0.3.2 on Maven Central.
Gradle plugin: dev.nucleusframework.compose-swiftui 0.3.2 on the Gradle Plugin Portal.
IDE plugin (previews in IntelliJ IDEA / Android Studio): download the zip below, then
Settings › Plugins › ⚙ › Install Plugin from Disk.
Full Changelog: v0.3.1...v0.3.2
v0.3.1
Added
- IntelliJ IDEA / Android Studio plugin (
intellij-plugin): Kotlin files with@Previewopen in a code | preview split
editor, with a gutter icon per preview. Previews are rendered with real SwiftUI on the iOS simulator by the new
renderComposeSwiftUIPreviewsGradle task, and again on every save.
Fixed
TextEditorView(TextEditor(text:))was read-only: bindings inside nested values were sent to SwiftUI as constants.
They now update the text and call the KotlinonTextChangecallback.
Install with the Gradle plugin in your shared KMP module:
plugins {
id("dev.nucleusframework.compose-swiftui") version "0.3.1"
}Library: dev.nucleusframework:compose-swiftui:0.3.1 on Maven Central.
Gradle plugin: dev.nucleusframework.compose-swiftui 0.3.1 on the Gradle Plugin Portal.
IDE plugin (previews in IntelliJ IDEA / Android Studio): download the zip below, then
Settings › Plugins › ⚙ › Install Plugin from Disk.
What's Changed
- IntelliJ plugin: render @Preview composables next to the code by @kdroidFilter in #1
- Fix read-only bindings in nested expressions (TextEditor) by @kdroidFilter in #2
New Contributors
- @kdroidFilter made their first contribution in #1
Full Changelog: v0.3.0...v0.3.1
v0.3.0
Added
@Previewfor Compose SwiftUI composables, rendered in Xcode's canvas. The Gradle plugin finds top-level,
parameterless@Preview @Composablefunctions (any annotation namedPreviewworks) and writes
ComposeSwiftUIPreviews.swiftnext to the renderer, with one Swift#Previewper function and a
ComposeSwiftUIPreviewGalleryview that lists them all. The task isgenerateComposeSwiftUIPreviews.LazyForEach(items, key) { item -> }for long lists: inside aListor a lazy stack, a row is composed only while
SwiftUI shows it, and disposed when it scrolls away. A 10,000-row list now mounts in 28 ms instead of 909 ms on the
iOS simulator, and a one-row change takes 0.4 ms instead of 4.5 ms.- A scenario benchmark (
scripts/run_scenarios.sh): long lists (mount, scrolling, one-row change, every row changed)
and animations, compared with plain SwiftUI using native@Observablemodels. - The sample app has two previews, a 5,000-row list and opens the preview gallery from its home screen.
Changed
- Generated containers render their content through
ChildrenView, andflushCompose()runs up to four passes so that
state written by effects is shown in the same SwiftUI update.
Install with the Gradle plugin in your shared KMP module:
plugins {
id("dev.nucleusframework.compose-swiftui") version "0.3.0"
}Library: dev.nucleusframework:compose-swiftui:0.3.0 on Maven Central.
Gradle plugin: dev.nucleusframework.compose-swiftui 0.3.0 on the Gradle Plugin Portal.
Full Changelog: v0.2.1...v0.3.0
v0.2.1
Added
UIKitView,UIViewControllerView,AppKitViewandNSViewControllerViewtake asizingparameter.
NativeViewSizing.FitHeightsizes the embedded view to its content at the proposed width, so a paragraph of variable
length is neither cut nor followed by a gap.FitContentuses the content's size in both directions.Fill, the
default, keeps the previous behavior.- The same four functions take an
updatecallback that runs on every recomposition, to push Kotlin state into the
embedded view.
Install with the Gradle plugin in your shared KMP module:
plugins {
id("dev.nucleusframework.compose-swiftui") version "0.2.1"
}Library: dev.nucleusframework:compose-swiftui:0.2.1 on Maven Central.
Gradle plugin: dev.nucleusframework.compose-swiftui 0.2.1 on the Gradle Plugin Portal.
Full Changelog: v0.2.0...v0.2.1
v0.2.0
Added
TabView(selection, onSelectionChange)andTab(title, systemImage, value): the selected tab is Kotlin state, so
code can switch tabs (for example a button in one tab that opens another). Tapping the tab bar calls
onSelectionChange.- Mixed-style text:
Text(StyledString), built withbuildStyledString { withStyle(SpanStyle(...)) { append(...) } }
like Compose'sbuildAnnotatedString. ASpanStylesets color, font, font size, weight, design, italic, underline,
strikethrough, monospaced, baseline offset and kerning. Nested styles merge. This replacesText + Textand
AttributedString, which Kotlin can't express. - The sample app shows both: a tab bar switched from Kotlin and a styled paragraph.
Install with the Gradle plugin in your shared KMP module:
plugins {
id("dev.nucleusframework.compose-swiftui") version "0.2.0"
}Library: dev.nucleusframework:compose-swiftui:0.2.0 on Maven Central.
Gradle plugin: dev.nucleusframework.compose-swiftui 0.2.0 on the Gradle Plugin Portal.
Full Changelog: v0.1.1...v0.2.0
v0.1.1
Install with the Gradle plugin in your shared KMP module:
plugins {
id("dev.nucleusframework.compose-swiftui") version "0.1.1"
}Library: dev.nucleusframework:compose-swiftui:0.1.1 on Maven Central.
Gradle plugin: dev.nucleusframework.compose-swiftui 0.1.1 on the Gradle Plugin Portal.
Full Changelog: v0.1.0...v0.1.1
v0.1.0
First release of Compose SwiftUI: write SwiftUI screens in Kotlin with the Compose runtime, on iOS, macOS, tvOS and watchOS.
Install with the Gradle plugin in your shared KMP module (Kotlin 2.4.20+):
plugins {
kotlin("multiplatform")
id("dev.nucleusframework.compose-swiftui") version "0.1.0"
}Then build once in Xcode, add the generated iosApp/ComposeSwiftUI folder to your app target, and show a screen with ComposeView { MyScreenKt.myScreen() }. The README has the full guide.
What's in 0.1.0:
- Kotlin API generated from the SwiftUI SDK: 3,568 entries of Apple's SwiftUI documentation, each compiled for iOS, macOS, tvOS and watchOS.
- Your androidx
ViewModels,StateFlows andrememberstate work unchanged. - Hand-written APIs for navigation by path, item-driven sheets and alerts, environment values, focus, gestures, matched geometry,
withAnimation, custom layouts and shapes, and embedded UIKit/AppKit views. - Benchmark of 50 screens against plain SwiftUI: updates 0.82x the time on iOS and 0.99x on macOS, mounts 1.06x and 1.14x; 48/50 screens pixel-identical on iOS, 50/50 on macOS.
Artifacts: dev.nucleusframework:compose-swiftui:0.1.0 on Maven Central, plugin dev.nucleusframework.compose-swiftui 0.1.0 on the Gradle Plugin Portal.