https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
j

Joan Colmenero

02/27/2020, 7:55 PM
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

kpgalligan

02/27/2020, 8:02 PM
Anything that’s swift specific won’t import
j

Joan Colmenero

02/27/2020, 8:02 PM
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

Joan Colmenero

02/27/2020, 8:10 PM
And what shall I use as a logger for swift?
k

kpgalligan

02/27/2020, 8:10 PM
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

Joan Colmenero

02/27/2020, 8:10 PM
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

kpgalligan

02/27/2020, 8:12 PM
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

Joan Colmenero

02/27/2020, 8:13 PM
but os_log is not working, right?
Let me try
k

kpgalligan

02/27/2020, 8:14 PM
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

Joan Colmenero

02/27/2020, 8:16 PM
I'm using 3.5.3 AS
k

kpgalligan

02/27/2020, 8:16 PM
Don’t use that
j

Joan Colmenero

02/27/2020, 8:16 PM
Is about the version? 😕
k

kpgalligan

02/27/2020, 8:16 PM
I’ve had issues resolving some ios libraries with that version
That
j

Joan Colmenero

02/27/2020, 8:17 PM
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

kpgalligan

02/27/2020, 8:19 PM
Not sure what you’re asking
j

Joan Colmenero

02/27/2020, 8:20 PM
I was about to use the log of os_log as os_log("message", .error) is the same for NSLog?
k

kpgalligan

02/27/2020, 8:21 PM
I don’t know? I’ve only used NSLog
j

Joan Colmenero

02/27/2020, 8:21 PM
Version 3.6 and still can not resolve platform :S
k

kpgalligan

02/27/2020, 8:21 PM
What is your gradle config
?
a

Arkadii Ivanov

02/27/2020, 11:49 PM
Are you working on Mac?
j

Joan Colmenero

02/28/2020, 12:09 AM
Yes
r

rudolf.hladik

02/28/2020, 11:06 AM
or you can use Kotlin
print(message: String)
|
println()
10 Views