Skip to main content

Sealed Classes

Enabled (Boolean)

If true, SKIE generates the wrapping enum and onEnum(of:) function for the given sealed class/interface.

The default value is true.

Annotation configuration:

Kotlin
import co.touchlab.skie.configuration.annotations.SealedInterop

@SealedInterop.Enabled
sealed interface Enabled

@SealedInterop.Disabled
sealed interface Disabled

Gradle configuration:

build.gradle.kts
import co.touchlab.skie.configuration.SealedInterop

skie {
features {
group {
SealedInterop.Enabled(true) // or false
}
}
}

ExportEntireHierarchy (Boolean)

If true, SKIE exports all public sealed children of this class/interface to Obj-C even if they wouldn't be exported by the Kotlin compiler. Otherwise, SKIE does not modify the default behavior. This setting applies only to public classes/interfaces that originate in a module that is not explicitly exported.

The default value is true.

Annotation configuration:

Kotlin
import co.touchlab.skie.configuration.annotations.SealedInterop

@SealedInterop.EntireHierarchyExport.Enabled
sealed interface EntireHierarchyExportEnabled

@SealedInterop.EntireHierarchyExport.Disabled
sealed interface EntireHierarchyExportDisabled

Gradle configuration:

build.gradle.kts
import co.touchlab.skie.configuration.SealedInterop

skie {
features {
group {
SealedInterop.ExportEntireHierarchy(true) // or false
}
}
}

Function

These settings apply to the onEnum(of:) function generated by this feature.

Name (String)

Controls the name of the function.

The default value is onEnum.

Annotation configuration:

Kotlin
import co.touchlab.skie.configuration.annotations.SealedInterop

@SealedInterop.Function.Name("onEnum2")
sealed interface HasCustomFunctionName

Gradle configuration:

build.gradle.kts
import co.touchlab.skie.configuration.SealedInterop

skie {
features {
group {
SealedInterop.Function.Name("onEnum2")
}
}
}

ArgumentLabel (String)

Controls the argument label for the only parameter of the function.

There are two special values: empty string and _. An empty string means the argument label is omitted and the parameter name is used instead when calling this function. _ disables the usage of explicit argument label.

The default value is of.

Annotation configuration:

Kotlin
import co.touchlab.skie.configuration.annotations.SealedInterop

@SealedInterop.Function.ArgumentLabel("of2")
sealed interface HasCustomFunctionArgumentLabel

Gradle configuration:

build.gradle.kts
import co.touchlab.skie.configuration.SealedInterop

skie {
features {
group {
SealedInterop.Function.ArgumentLabel("of2")
}
}
}

ParameterName (String)

Controls the parameter name for the only parameter of the function.

The default value is sealed.

Annotation configuration:

Kotlin
import co.touchlab.skie.configuration.annotations.SealedInterop

@SealedInterop.Function.ParameterName("sealed2")
sealed interface HasCustomFunctionParameterName

Gradle configuration:

build.gradle.kts
import co.touchlab.skie.configuration.SealedInterop

skie {
features {
group {
SealedInterop.Function.ParameterName("sealed2")
}
}
}

ElseName (String)

The name for the custom else case that is generated if some children are hidden / not accessible from Swift.

The default value is else.

Annotation configuration:

Kotlin
import co.touchlab.skie.configuration.annotations.SealedInterop

@SealedInterop.ElseName("else2")
sealed interface HasCustomElseName

Gradle configuration:

build.gradle.kts
import co.touchlab.skie.configuration.SealedInterop

skie {
features {
group {
SealedInterop.ElseName("else2")
}
}
}

Case

These settings apply to the enum cases of the enum generated by this feature.

Visible (Boolean)

If false, the given subclass will be hidden from the generated code, meaning no dedicated enum case will be generated. All hidden subclasses will be grouped under the else case.

The default value is true.

Annotation configuration:

Kotlin
import co.touchlab.skie.configuration.annotations.SealedInterop

sealed interface SealedInterface {

@SealedInterop.Case.Visible
object Visible : SealedInterface

@SealedInterop.Case.Hidden
object Hidden : SealedInterface
}

Gradle configuration:

build.gradle.kts
import co.touchlab.skie.configuration.SealedInterop

skie {
features {
group {
SealedInterop.Case.Visible(true) // or false
}
}
}

Name (String?)

Overrides the name of the enum case generated for a given subclass.

The default value is null.

Annotation configuration:

Kotlin
import co.touchlab.skie.configuration.annotations.SealedInterop

sealed interface SealedInterface {

@SealedInterop.Case.Name("CustomName2")
object CustomName : SealedInterface
}

Gradle configuration:

build.gradle.kts
import co.touchlab.skie.configuration.SealedInterop

skie {
features {
group {
SealedInterop.Case.Name("CustomName2")
}
}
}