# How should SupportedPlatform work?

**URL:** <https://forums.swift.org/t/how-should-supportedplatform-work/45213>\
**Category:** Using Swift\
**Tags:** packagemanager\
**Created:** [March 2, 2021, 7:00am UTC](https://forums.swift.org/t/how-should-supportedplatform-work/45213 "2021-03-02T07:00:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![SDGGiesbrecht](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sdggiesbrecht/32/4768_2.png) [@SDGGiesbrecht](https://forums.swift.org/u/SDGGiesbrecht)\
**Post date:** [March 2, 2021, 8:30am UTC](https://forums.swift.org/t/how-should-supportedplatform-work/45213/2 "2021-03-02T08:30:43Z")

</div>

> [@pahnev](#):
>
> If the package manifest defines that it supports only iOS [...], why does Xcode still allow that package to be added to a macOS project?

`platforms: [.iOS(.v11)]` means roughly the same thing as `@available(iOS 11, *)`. It declares that the package requires at least iOS 11, but is fully available on any other platform.

Do not consider the `platforms` parameter as an exhaustive list of the platforms a package supports. Such version limitations can only be declared for platforms that contain the standard library embedded in the operating system. For platforms where the standard library must be distributed with the product (statically or dynamically), version constraints would make no sense. You will never see Windows, the various Linux flavours, web assembly or Android in that list even for packages that expressly support them.

Many packages do not touch any platform‐specific details and will just work everywhere. The `platforms` list was deliberately designed to make it easier for new or exotic platforms to use a package, even if the package author has never heard of the platform. Thus there is no way of deliberately barring a package from compiling on a particular platform. (Should you discover a good reason to break that guideline, it _is_ possible to combine `#if` with `#error` in a source file.)

If you want to communicate to clients which platforms are actively tested and known to be stable, that sort of information belongs in the package’s read‐me or documentation.

> [@pahnev](#):
>
> Or why does `swift build` try to build for macOS?

Officially, command‐line SwiftPM only—and always—supports building for the host platform. (Some experimental support does exist for cross‐compilation if you monkey around with building Swift from source to get the pieces you need).

---

_[View the full topic](https://forums.swift.org/t/how-should-supportedplatform-work/45213)._
