Most important is a fix for an occasional crash due to a use-after-free
bug.
A number of API availability declarations were updated to include tvOS.
The code is now simplified and generic for all platforms, which makes
way for future tvOS support.
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>