Instance Property

utf8String

A null-terminated UTF8 representation of the string.

Declaration

var utf8String: UnsafePointer<Int8>? { get }

Discussion

This C string is a pointer to a structure inside the string object, which may have a lifetime shorter than the string object and will certainly not have a longer lifetime. Therefore, you should copy the C string if it needs to be stored outside of the memory context in which you use this property.