I ran into this too and figured it out. The issue is that the to_chars functions’ availability attributes use the “strict” modifier, which means it isn’t possible to check for them at runtime. From the Clang docs:
The flag strict disallows using API when deploying back to a platform version prior to when the declaration was introduced. An attempt to use such API before its introduction causes a hard error.
So unfortunately, to use these functions in an app that supports older OSs, you have to use compile-time checks with ifdefs.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: