Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rickclephas/kotlin-docc

Generate Swift DocC documentation for your Kotlin Multiplatform frameworks
https://github.com/rickclephas/kotlin-docc

api-reference documentation kotlin swift

Last synced: 2 months ago
JSON representation

Generate Swift DocC documentation for your Kotlin Multiplatform frameworks

Awesome Lists containing this project

README

        

# Kotlin-DocC

Kotlin-DocC is a Gradle plugin that integrates the [`docc`](https://github.com/apple/swift-docc)
CLI into your Kotlin Multiplatform projects.

Generating your first `.doccarchive` is as easy as applying the plugin:

```kotlin
plugins {
id("com.rickclephas.kmp.docc") version "0.1.0"
}
```

and running the `doccConvert` or `doccPreview` task for your target's framework.

Both the `doccConvert` and `doccPreview` tasks can be configured with the `docC` extension:

```kotlin
import com.rickclephas.kmp.docc.dsl.docC

group = "com.example"
version = "1.0"

kotlin {
macosArm64 {
binaries.framework {
baseName = "MyFramework"

docC {
// Configure the doccConvert and doccPreview tasks
common {
// Configure the fallback values for the documentation bundle's Info.plist properties
displayName.set("MyFramework")
bundleIdentifier.set("com.example.MyFramework")
bundleVersion.set("1.0")

// Use a custom Swift-DocC-Render template,
// by default the Kotlin-DocC-Render template is used.
// Setting this to `null` wil use the built-in Xcode template.
renderDir.set(null as Directory?)

// Adds additional arguments to the docc command
additionalArgs.add("--warnings-as-errors")
}

// Configure the doccConvert task
convert {
// Indicates if the `process-archive index` command should be run
createIndex.set(false)
}

// Configure the doccPreview task
preview {
// The port number to use for the preview web server
port.set(8080)
}
}
}
}
}
```

To further customize your documentation you can generate a `.docc` documentation bundle by adding files to
`src/commonMain/docc`, or the `docc` folder of other source-sets.

Take a look at the official DocC [documentation](https://www.swift.org/documentation/docc) to learn more about
[formatting your documentation content](https://www.swift.org/documentation/docc/formatting-your-documentation-content)
and [adding structure to your documentation pages](https://www.swift.org/documentation/docc/adding-structure-to-your-documentation-pages).