It seems that preinstall/postinstall scripts in installer packages (.pkg) are not limited to shell scripts, but can be any kind of executable (e.g. compiled Swift programs).
This sounds like an exciting possibility to re-use logic, constants, tests etc. from the app that is being installed, and at the same time benefit from Swift features like type safety for complex installer scripts.
Has anyone done this? What were your experiences?
Is it advisable, or is it likely to break on the next OS update?