With a string literal, you’re right that it will work, even though it’s still invalid Swift - the string’s data is likely stored in the constant data section of the binary and therefore should always have a valid pointer. For non-constant strings, the last use of the string’s data is in the
vk.ApplicationInfo, so the compiler is free to release any memory associated with that string immediately after that call, potentially invalidating any pointers derived from it. The difference between Swift and C here is that in C values live until the end of the current scope, whereas in Swift they live until their last usage.
Again, this all may work today, but be prepared for it to break in strange edge cases or with new compiler optimisations.