Integration
Add the UI component to your application based on your targeted platform.
Compose Multiplatform (Common)¶
- Use
KtorMonitorComposable
Android¶
- If
showNotifcation = trueand android.permission.POST_NOTIFICATIONS is granted, the library will display a notification showing a summary of ongoing KTOR activity. Tapping on the notification launches the fullKtorMonitor. - Apps can optionally use the
KtorMonitor()Composable directly into own Composable code. - For Android minSdk < 26, Core Library Desugaring is required.
iOS¶
-
If
showNotifcation = trueand notification permission is granted, the library will display a notification showing a summary of ongoing KTOR activity. -
Use
KtorMonitorViewController
struct KtorMonitorView: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UIViewController {
MainViewControllerKt.MainViewController()
}
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
}
struct ContentView: View {
var body: some View {
KtorMonitorView()
.ignoresSafeArea()
}
}
Desktop (Compose)¶
- Use
KtorMonitorWindowComposable
fun main() = application {
var showKtorMonitor by rememberSaveable { mutableStateOf(false) }
KtorMonitorWindow(
onCloseRequest = { showKtorMonitor = false },
show = showKtorMonitor
)
}
- Use
KtorMonitorWindowComposable withKtorMonitorMenuItem
fun main() = application {
var showKtorMonitor by rememberSaveable { mutableStateOf(false) }
Tray(
icon = painterResource(Res.drawable.ic_launcher),
menu = {
KtorMonitorMenuItem { showKtorMonitor = true }
}
)
KtorMonitorWindow(
show = showKtorMonitor,
onCloseRequest = { showKtorMonitor = false }
)
}
Desktop (Swing)¶
- Use
KtorMonitorPanelSwing Panel
fun main() = application {
SwingUtilities.invokeLater {
val frame = JFrame()
frame.add(KtorMonitorPanel, BorderLayout.CENTER)
frame.isVisible = true
}
}
Wasm / Js¶
- Web targets require a few additional webpack steps.
kotlin {
sourceSets {
webMain.dependencies {
implementation(devNpm("copy-webpack-plugin", "9.1.0"))
}
}
}