How? I assume it's mostly using proprietary MacOS APIs, and, ignoring that it doesn't really matter beyond apple being an abusive partner, lawyers are a powerful tool (This software is under the Apple don't take the piss licence)
Assuming the License is that restrictive, only those who are financially invested in Preview working well (and only on macOS) will have any incentive to contribute code.
I can't think of any company other than Apple that fit this description.
There already is an equivalent feature in GNOME. Preview's code is of little value outside of Mac. It's also not rocket science, that the thing stopping other people from doing the same thing would be lack of access to original source code. :)