Xcode Playground

Hello everyone,

Is there a way to set the minimum deployment target in Xcode Playground?

Answered by CMDdev in 777182022

Hi, yes, you can modify the Package.swift file included in your playground. It is normally not accessible within Xcode / Swift Playgrounds but you can edit it if you show the playground's contents in Finder. This file's names comes from Swift packages (Playgrounds are essentially a special type of Swift Package).

Be aware that this file is automatically generated, so there may be chances for it to be overwritten when you change playground's settings, as the warning at the top of it suggests (I would also like more insight into this if somebody else knows - is editing the minimum target version or the target resources a good practice, or is it at risk to be overwritten? From my testings, it seems to work fine with changing the target resources).

Check this thread for ideas on how to support older iOS versions in your code, or modify your Package.swift file like I explained above.

If this is for the Swift Student Challenge (as your tag suggests), I'm not sure if it's okay to modify the minimum target version. Perhaps the judges will have the latest version of iPadOS / macOS, but currently the website says the following:

"Your app playground must be built with and run on Swift Playgrounds 4.4 or later (requires iPadOS 16 or macOS 13.5) or Xcode 15 on macOS 13.5 or later. You may incorporate the use of Apple Pencil."

https://developer.apple.com/swift-student-challenge/eligibility/

Accepted Answer

Hi, yes, you can modify the Package.swift file included in your playground. It is normally not accessible within Xcode / Swift Playgrounds but you can edit it if you show the playground's contents in Finder. This file's names comes from Swift packages (Playgrounds are essentially a special type of Swift Package).

Be aware that this file is automatically generated, so there may be chances for it to be overwritten when you change playground's settings, as the warning at the top of it suggests (I would also like more insight into this if somebody else knows - is editing the minimum target version or the target resources a good practice, or is it at risk to be overwritten? From my testings, it seems to work fine with changing the target resources).

Check this thread for ideas on how to support older iOS versions in your code, or modify your Package.swift file like I explained above.

If this is for the Swift Student Challenge (as your tag suggests), I'm not sure if it's okay to modify the minimum target version. Perhaps the judges will have the latest version of iPadOS / macOS, but currently the website says the following:

"Your app playground must be built with and run on Swift Playgrounds 4.4 or later (requires iPadOS 16 or macOS 13.5) or Xcode 15 on macOS 13.5 or later. You may incorporate the use of Apple Pencil."

https://developer.apple.com/swift-student-challenge/eligibility/

Last year’s Swift Student Challenge T&Cs said:

Your app playground must be fully functioning, and be built with and run on Swift Playgrounds 4.2.1 on iPadOS 16 or macOS 13 or Xcode 14 on macOS 13. You may incorporate the use of Apple Pencil.

That was the latest stuff as of early 2023.

While we won’t know for such until the 2024 T&Cs are published — Swift Student Challenge > Eligibility indicates that it’ll be in February — I expect they’ll have similar requirements, that is, all the latest stuff as of early 2024. Presuming that, you won’t need to play games with deployment targets.

IMPORTANT Don’t rely on this presumption. Check the final T&Cs when they’re published.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Xcode Playground
 
 
Q