Hello! I am currently exploring the world of kotli...
# kotlin-native
m
Hello! I am currently exploring the world of kotlin-native in the context of a multiplatform project. However I have some newby problems with converting syntax. How I map
Copy code
NSData *nsdataFromBase64String = [[NSData alloc]initWithBase64EncodedString:base64Encoded options:0];
into Kotlin? I understand what the function wants...but I do not catch the
[NSData alloc]
to write in Kotlin. Anybody here maybe knows that?
s
That one has some special creation functions setup for it on the Kotlin side.
Copy code
NSData.create(base64EncodedString = dataString, options = NSDataBase64Encoding64CharacterLineLength)
m
A very big thank you from my side - it does the trick!
Is there any place where such stuff is collected? - My question is a typical CheatSheet question, I guess.
s
Not that I am aware of. It would be nice to have for these special cases. Generally the calling into objc looks like how you would expect. If you have to drop down to CoreFoundation things get ugly quick but I would expect that since the memory management is all manual.
m
Unfortunate. Maybe it is time then to start one then. I hope I can avoid that, otherwise I could write in Rust or directly in C and export bindings, that's quicker and due to my leak of knowledge safer I guess.
However really thx for your help! It safed my day!