code
const char* hoge() {
char* var = "HELLO WORLD";
return var;
}
I want to convert the return value of a function that returns such a pointer to a String in swift (assuming a bridge)
code
String(cString: UnsafePointer<CChar>(hoge())!)
Since Swift's String can handle cString Get pointer of CChar type-> convert to cString-> convert to String
If there is a better way, please teach me.
Recommended Posts