[swift-users] String init from Int8 tuple?

Quinn "The Eskimo!" eskimo1 at apple.com
Wed Apr 19 02:16:13 CDT 2017

On 19 Apr 2017, at 02:11, Rick Mann via swift-users <swift-users at swift.org> wrote:

> In my C-interop, I have a need to do this a lot:

I think you’re working too hard here.  Try this:

func callbackFailed(info inInfo: lgs_result_info_t) {
   var m = inInfo.message
   let message = String(cString: &m.0)
   debugLog("Failed: \(message)")

Alas, you still need to do the copy in order to take the address of `m`.

Share and Enjoy
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

More information about the swift-users mailing list