There's a ton of references to this question but none of them seem to work. I'm using Xcode 14.1. What am I doing wrong?
I have a C buffer in a struct:
struct MY_C_STRUCT
{
char buff[256]; //Contains null-terminated C-string in UTF-8 encoding
};
and I have a Swift struct where I'm trying to set its variable from MY_C_STRUCT::buff:
class MyStruct : ObservableObject
{
@Published public var Buff : String = ""
func from_MY_C_STRUCT(mi : MY_C_STRUCT)
{
Buff = String(cString: mi.buff)
}
}
That gives me on the String(cString:) line:
No exact matches in call to initializer
record.namereplaced bymi.buff, of course) compiles without problems in my test.