As indicated in swift/docs/EmbeddedSwift/UserManual.md at main · swiftlang/swift, posix_memalign is an external dependency for which you need to provide an implementation yourself.
Depending on whether you're using an SDK or not, the implementation might differ. Searching for posix_memalign on this forums will provide some pointers e.g. Example Pico-W code works on SuperCon badge - Development / Embedded - Swift Forums