swift-aoc-starter-example icon indicating copy to clipboard operation
swift-aoc-starter-example copied to clipboard

Add iOS, watchOS and tvOS min targets to Package.swift

Open azarovalex opened this issue 1 year ago • 2 comments
trafficstars

The package uses async/await, ContinuousClock and some other API only available from iOS 16.

Right now Package.swift doesn't specify minimum supported targets for all the platforms except for macOS, so trying to clone and build the repo in Xcode can result in errors, even though you can run the main executable target on any platforms, including iOS.

Even though it's not common to run executable targets on iOS/tvOS or watchOS, some developers use AOC as an opportunity to try a new language, in our case Swift, it would be nice to make the setup process as smooth as possible.

azarovalex avatar Dec 02 '23 20:12 azarovalex

Does SPM support visionOS? if so could you update this PR with that platform as well?

rauhul avatar Dec 06 '23 05:12 rauhul

@rauhul It does since this package specifies swift-tools-version: 5.9. By default, SPM assumes visionOS v1, which roughly corresponds to iOS 17 and already supports all the APIs this package uses, so we don't have to set the version explicitly.

We might want to be extra explicit and specify it anyway, but these platforms are optional, so I think that the high-level idea of SPM is that by not specifying a platform we are saying that "it will work on any version", which is true for visionOS, but not true for iOS, tvOS or watchOS for which we set the supported versions in this PR.

azarovalex avatar Dec 06 '23 12:12 azarovalex