Skip to content

Instantly share code, notes, and snippets.

@KovshefulCoder
KovshefulCoder / A Spotless Compose Modifier chain split into lines
Last active May 3, 2025 08:33
Custom Spotless step that allow to split Modifier's functions chain calls into lines (like ij_kotlin_method_call_chain_wrap = split_into_lines in .editorconfig)
Placeholder to fix gist name
@KovshefulCoder
KovshefulCoder / KMP Android and iOS UI Alert
Last active April 26, 2025 18:10
KMP Android/iOS UI Alert (Toast/Alert dialog). Does not require Compose. Uses androidx.startup on Android, but this can be avoided by manually accessing Context or by marking the function as @composable and using LocalContext.current
Placeholder to fix gist name
@KovshefulCoder
KovshefulCoder / SafeErrBodyDeserialization.kt
Created April 7, 2024 13:04
Safe deserializeErrorBody for skydoves/sandwich library
package ru.kovsharev.porykam.core.utils
import com.skydoves.sandwich.ApiResponse
import com.skydoves.sandwich.retrofit.serialization.deserializeErrorBody
import kotlinx.serialization.SerializationException
import kotlinx.serialization.json.Json
/**
* Deserializes the Json string from error body of the [ApiResponse.Failure.Error] to the [E] custom type.
* It returns `null` if the error body is empty or catched exception.