Hey everyone! i'm working on a Compose Multiplatfo...
# multiplatform
e
Hey everyone! i'm working on a Compose Multiplatform project! need to see the iOS logs, how can i do that? if a added print still not seeing in xcode neither
g
Use Napier lib or use NSLog, OSLog
e
NSLog in swift code por example?
i need to know some logs on swift code, but i think Napier is only for kt files right?
g
🟦 1. commonMain/logger.kt
Copy code
expect object KLogger {
    fun d(message: String)
    fun e(message: String)
}
--- 🟩 2. androidMain/logger.kt
Copy code
actual object KLogger {
    actual fun d(message: String) {
        android.util.Log.d("KMM", message)
    }

    actual fun e(message: String) {
        android.util.Log.e("KMM", message)
    }
}
--- 🍏 3. iosMain/logger.kt
Copy code
import platform.Foundation.NSLog

actual object KLogger {
    actual fun d(message: String) {
        NSLog("🟢 DEBUG: %@", message)
    }

    actual fun e(message: String) {
        NSLog("🔴 ERROR: %@", message)
    }
}
---
e
thanks man!