Hello guys, I'm playing with Kotlin MP and on my i...
# multiplatform
j
Hello guys, I'm playing with Kotlin MP and on my iosMain using Android Studio I'm not able to import libraries like the Log from Swift any idea?
k
Anything that’s swift specific won’t import
j
Trying to import
*import* os.log
And it says unresolve reference
Do I have to open the project with InteliJ instead?
It is not available.
import os.log
is a swift thing
j
And what shall I use as a logger for swift?
k
We’ve used NSLog. Would like to figure out a way to do the swift log. You might be able to make an interface for logging and pass in a swift impl that delegates to the logging you want
j
Yep I did it
The thing is what to use, then NSLog?
Do you know the import? Do I have to use import platform.fundation.NSLog?
k
Copy code
inteface Logger {
fun log(s:String}
}
Copy code
class SwiftLogger: Logger {
func log(s:String){
os_log(foo) 
}
}
Yes
import platform.Foundation.NSLog
but AS should be able to resolve that
j
but os_log is not working, right?
Let me try
k
Install Android studio 3.6, make sure this is in iosMain code, and also use the split platform config rather than
ios()
https://github.com/touchlab/KaMPKit/blob/master/shared/build.gradle.kts#L24
j
I'm using 3.5.3 AS
k
Don’t use that
j
Is about the version? 😕
k
I’ve had issues resolving some ios libraries with that version
That
j
Ok, let me update it...
And about the NSLog, I'm using already a delegate to use it on iOS, do I have like on Android the log.d("TAG","message")? with debug, error, info, etc?
k
Not sure what you’re asking
j
I was about to use the log of os_log as os_log("message", .error) is the same for NSLog?
k
I don’t know? I’ve only used NSLog
j
Version 3.6 and still can not resolve platform :S
k
What is your gradle config
?
a
Are you working on Mac?
j
Yes
r
or you can use Kotlin
print(message: String)
|
println()