Jozef Matus
11/08/2020, 1:46 PMNSString.create(data = it, encoding = NSUTF8StringEncoding).toString()
and I cant find out how do you know about function name and definition. I have read on github kotlin native repo that those initializers are done via create factory but I cant find any documentation. Where can i find functions declarations please? I looked into platform.Foundation.NSString but I didn’t see create
Alexey Glushkov
11/08/2020, 2:52 PMJozef Matus
11/08/2020, 7:02 PMcreate
I just copy pasted it from web. I would like to be able to go through available api and discover how to use it.Alexey Glushkov
11/08/2020, 7:19 PMbut in kotlin it is done via create factory
Because it was not clear to my why should i useprobably this factory wrapper is required for the right interop between kotlin and objccreate
I would like to be able to go through available api and discover how to use itanyway as these factory functions are based on objc foundation you can easily infer available create methods looking at the apple doc Also, in my case when I type NSString.create, Android Studio autocompletion works as expected. Then I can jump to all the wrapped create methods using “go to type declaration” function. On my mac the file is placed here .konan/kotlin-native-prebuilt-macos-1.4.10/klib/commonized/ios_arm64-ios_x64-MS40LjEw/common/org.jetbrains.kotlin.native.platform.Foundation/default/linkdata/package_platform.Foundation/30_Foundation.knm
// IntelliJ API Decompiler stub source generated from a class file
// Implementation of methods is not available
package platform.Foundation
...
public external expect fun <T : platform.Foundation.NSString> kotlinx.cinterop.ObjCClassOf<T>.create(cString: kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, length: platform.darwin.NSUInteger /* = kotlin.ULong */): T? { /* compiled code */ }
public external expect fun <T : platform.Foundation.NSString> kotlinx.cinterop.ObjCClassOf<T>.create(cStringNoCopy: kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, length: platform.darwin.NSUInteger /* = kotlin.ULong */, freeWhenDone: kotlin.Boolean): T? { /* compiled code */ }
...
I use
Android Studio 4.1 RC 3
Build #AI-201.8743.12.41.6823847, built on September 10, 2020
Jozef Matus
11/08/2020, 7:21 PMAlexey Glushkov
11/08/2020, 7:23 PM