swiftpoet / io.outfoxx.swiftpoet / CodeBlock

CodeBlock

class CodeBlock

A fragment of a .kt file, potentially containing declarations, statements, and documentation. Code blocks are not necessarily well-formed Kotlin code, and are not validated. This class assumes kotlinc will check correctness later!

Code blocks support placeholders like java.text.Format. This class uses a percent sign % but has its own set of permitted placeholders:

Types

Builder

class Builder

Functions

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

isEmpty

A heterogeneous list containing string literals and value placeholders.

fun isEmpty(): Boolean

isNotEmpty

fun isNotEmpty(): Boolean

toBuilder

fun toBuilder(): Builder

toString

fun toString(): String

Companion Object Properties

ABSTRACT

val ABSTRACT: CodeBlock

Companion Object Functions

builder

fun builder(): Builder

of

fun of(format: String, vararg args: Any?): CodeBlock