The current art of Build Configuration Tests

Swift now supports the following configuration tests:

  • The literals `true` and `false`
  • The `os()` function that tests for `OSX, iOS, watchOS, tvOS, Linux, Windows, and FreeBSD`
  • The `arch()` function that tests for `x86_64, arm, arm64, i386, powerpc64, and powerpc64le`
  • The `swift()` function that tests for specific Swift language releases, e.g. `swift(>=2.2)`

Update additions thanks to Dmitri Gribenko, who knows the source code.

Comments are closed.