When interacting with a C api (the SQLite 3 C api) from Swift, I need to pass a pointer to a pointer to const char as an out-parameter:
sqlite3_prepare_v2(
// snip other parameters
const char **pzTail // OUT parameter
);
Which is translated into Swift as:
sqlite3_prepare_v2(
// snip other parameters
UnsafeMutablePointer<UnsafePointer<Int8>>
)
This out parameter wants to end up usable as a string.
You can pass a Swift String
to a const char *
easily, but I don't understand how to get something usable from the double-indirection.
Can anyone shed some light here?