KiteConfigNativeOptInsExtension

Kotlin/Native opt-in markers, inside kiteConfig { optIns { ... } }.

kiteConfig {
optIns {
add("kotlin.experimental.ExperimentalObjCRefinement")
}
}

Obj-C and cinterop calls each want an @OptIn(...) above them. This block sets the markers once at the compiler level, and only on Native compilations, where those markers actually resolve. The annotations leave your call sites and your shared code is never edited.

An empty optIns { } already does useful work. Opening the block turns the feature on, and the built-in set covers the usual interop cases.

What ends up on the compiler command line

You writeMarkers applied
no block at allnone, the feature is off
optIns { }the built-in interop set
optIns { add("x") }the built-in set plus x
optIns { builtIns = false; add("x") }only x

Markers reach Kotlin/Native compilations only, in the shared project or in whatever projects names. They are never written into your source.

See also

for the project used when projects is empty.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
abstract val builtIns: Property<Boolean>

Whether KiteConfig's own interop set is applied: kotlinx.cinterop.ExperimentalForeignApi, kotlin.experimental.ExperimentalObjCName, and kotlin.experimental.ExperimentalNativeApi.

Link copied to clipboard
abstract val markers: ListProperty<String>

Extra opt-in markers, fully qualified, such as "kotlin.experimental.ExperimentalObjCRefinement".

Link copied to clipboard
abstract val projects: ListProperty<String>

Exact KMP project paths that receive the markers, absolute, such as ":shared" or ":core:network".

Functions

Link copied to clipboard
fun add(vararg markers: String)

Adds one or more fully qualified markers to markers.

Link copied to clipboard
fun projects(vararg paths: String)

Adds one or more project paths to projects.