Xcode playground projects don't supporting iOS 17?

I wanted to take some code I had written in an Xcode project and put it in a playground, though while working on a playground in Xcode, it's showing errors that some lines of code are only supported in iOS 17. I'm updated to the most recent version. Is there any reason why my playgrounds are showing this error?

I assume it might be due to the playground wanting to make sure the app works on older OSs, but a lot of the code I used has no previous counterpart. If this is the case, is there any way I can get around this?

Thanks for taking the time to check this out.

How are you testing this?

I tried it here in my office and it’s working for me. Specifically:

  1. Using Xcode 15.0 on macOS 13.6.1, I created a new playground from the iOS > Blank template.

  2. I replaced the code as shown below:

    import SwiftUI
    
    struct TestView: View {
        var body: some View {
            Text("Hello Cruel World!")
                .safeAreaPadding(EdgeInsets())
        }
    }
    
    print(UIDevice.current.systemVersion)
    
  3. I ran the playground. It printed 17.0, indicating that the code successfully compiled.

AFAIK Xcode runs an iOS playground in the latest iOS simulator, and for Xcode 15 that means the iOS 17 simulator.

Share and Enjoy

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

Xcode playground projects don't supporting iOS 17?
 
 
Q