将字节数组代码从 c 转换为 swift

Convert byte array code from c to swift

我在 objective c 项目的头文件中有这一行。

static const char my_bytes[] = { -30, 10, 90}

我想写在swift,怎么写?

let my_bytes : [CChar] = [-30, 10, 90]

CChar 只是 Int8 的别名。您可以在 Interacting with C API.

中阅读更多相关信息