Print Function Call Stack in Swift?

There is a backtracing library with a very nice API and support for async functions (details here), and I believe it also supports Windows.

You can access it using:

import _Backtracing

(Works on Xcode 15.0/Swift 5.9)

Symbol.name contains the demangled name for a symbol. Example:

import _Backtracing

print(
  try! Backtrace.capture(algorithm: .fast, limit: 1)
       .symbolicated()!
       .frames[0]
       .symbol!.name
)

Be advised:
The library hasn't been through swift-evolution yet, so it is still subject to change, and when it finally lands it will probably drop the leading underscore. So be prepared that your code may need adjustments if you update your toolchain.

Oh, and that also means it is not yet ABI stable. DO NOT use it in any apps or libraries that you ship on Apple platforms yet.