I declared Int in shared kmm model I am successful...
# multiplatform
a
I declared Int in shared kmm model I am successfully able to use that in Android but in iOS we have kotlinInt how to convert it in string in iOS I am new in iOS
Getting type of expression in ambitious
w
Our case they are coming as
Int32
, but in Swift you can do like
Int(valueFromKotlinWhichIsInt32)
Same the opposite n case you need to send something to Kotlin and the argument is type
Int32
:
Int32(swiftIntValue)
.
a
@wbertan I am getting as KotlinInt I don't know why and conversation not working
w
k
Note that KotlinInt derives from NSNumber so you can use all the methods and tricks described here: https://developer.apple.com/documentation/foundation/nsnumber
a
@Karel Petránek but it's SharedInt in my case
s
Shared
is a prefix for all your generated classes because that's the name of your multiplatform framework. Look at those
swift_name
attributes.
k
Right, in ObjC it is prefixed by the module name, in your case Shared, in Swift it is prefixed with Kotlin (you can see it in the swift_name annotation)
d
I suggest you take a look at the Swift language itself first. Doing do, you would overcome all conversion type issues involve with KMM easily.
441 Views