`#if os(Darwin)`, a shorthand for checking for Darwin platforms

By the nature of unannounced systems, the public doesn't know what public APIs they'll have, let alone their behaviors. So using os(Darwin) to target potential future systems isn't future-proofing, but a speculation that will likely introduce bugs in the future if any future system doesn't behave as it's assumed to.

As written upthread, in an os(Darwin) branch, the only thing that can be guaranteed is the existence of the Darwin module, but we already have canImport(Darwin) that makes the same guarantee.

7 Likes