iOS app running.

Map API key needs to be set in untracked file Config.local.xcconfig
Still issues with showing map
This commit is contained in:
Olof Hedman
2025-10-02 18:06:43 +02:00
parent cc4a99effb
commit 72d9b879c4
10 changed files with 168 additions and 27 deletions

View File

@@ -3,5 +3,15 @@ package app.klottr
import androidx.compose.ui.window.ComposeUIViewController
import platform.UIKit.UIViewController
fun MainViewController(): UIViewController =
ComposeUIViewController { KlottrRoot() }
fun MainViewController(
onRequestPerms: () -> Unit = {},
onLogin: () -> Unit = {},
onLogout: () -> Unit = {},
): UIViewController =
ComposeUIViewController {
KlottrAppShell(
onRequestPerms = onRequestPerms,
onLogin = onLogin,
onLogout = onLogout
)
}

View File

@@ -18,8 +18,11 @@ actual object KLog {
private fun log(level: String, tag: String?, text: () -> String) {
if (!enabled) return
val tg = tagOrDefault(tag)
// %@ konverterar Kotlin String -> NSString
NSLog("[$level][%@] %@", tg, text())
// Build string in kotlin
val msg = "[$level][$tg] ${text()}"
// Pass a single argument to avoid C-varargs issues
val safe = msg.replace("%", "%%") // prevent accidental format parsing
NSLog(safe)
}
actual fun d(tag: String?, msg: () -> String) = log("D", tag, msg)
@@ -29,10 +32,10 @@ actual object KLog {
actual fun e(tag: String?, t: Throwable?, msg: () -> String) {
if (!enabled) return
val tg = tagOrDefault(tag)
if (t != null) {
NSLog("[E][%@] %@ — %@", tg, msg(), t.stackTraceToString())
} else {
NSLog("[E][%@] %@", tg, msg())
}
val base = "[E][$tg] ${msg()}"
val full = if (t != null) "$base — ${t.stackTraceToString()}" else base
val safe = full.replace("%", "%%") // prevent accidental format parsing
NSLog(safe)
}
}