Posts

Post marked as solved
1 Replies
From the Shape protocol: https://developer.apple.com/documentation/swiftui/shape Capsule Circle ContainerRelativeShape Ellipse OffsetShape Path Rectangle RotatedShape RoundedRectangle ScaledShape TransformedShape
Post marked as solved
3 Replies
I was able to a new Learn to Code 1 playground on an Intel-based 16" MacBook Pro. Try creating a new one and see if that fixes the issue. It's probably not ideal if you lose your place, but may get you going until Apple fixes (submit Feedback inside the iPad app with the "..." or via developer feedback.)
Post not yet marked as solved
1 Replies
Yes, it's a lot more friendly to write Swift code on the new Swift Playgrounds 4 app. Errors are more straightforward and fixes are provided, which help beginners. The biggest challenge is that your screen space is limited, but it does force you to be more focused because you can only do one thing at a time (read documentation/stack overflow in Safari or write code in Swift Playgrounds). Using an external display will mirror the Swift Playground, which you can lower the font size to fit more code on screen. The new Swift app package is a quick way to prototype SwiftUI on narrow screen size, and also check how it adapts to larger screens. It makes it more fun to fast prototype a UI, and then you can tap it to see how it's working right on the device. Previously with Swift Playgrounds 3, I found myself running into corner cases trying to get my SwiftUI designs to work because there's no "app canvas", so you need to use a fixedSize() to fix some quirks. I had a lot more frustration prototyping UI on the old Swift Playgrounds 3, so the new version is 100% better for fast prototyping. Previous error messages were not verbose, or clear, so the new Swift Playgrounds 4 feels a lot better. You can import those Swift App Playgrounds on Xcode 13.2.1, but can't use them with the Mac Swift Playgrounds 4 (which may get fixed in an update?).
Post not yet marked as solved
5 Replies
I’m seeing the same issue on my iPad Pro 11” FB9121354: Swift Playgrounds on iPad does not update UI for @State variables The code works on Mac, not on iPad Playgrounds. import SwiftUI import PlaygroundSupport struct ContentView: View {     @State var isSelected: Bool = true     @State var useRedText = false     var body: some View {         VStack {             Text("SwiftUI on iPad")                 .font(.headline)                 .padding(20)                 .background(Color.red)                 .cornerRadius(10)             Text("Paul Rocks!")                 .font(.largeTitle)                 .padding(20)                 .background(isSelected ? Color.orange : Color.blue) //color())                 .cornerRadius(30)                 .onTapGesture {                      print("Paul Rocks")                     isSelected.toggle()                 }                          Button("Hello World") {                     // flip the Boolean between true and false                     self.useRedText.toggle()                       }                 .foregroundColor(useRedText ? .red : .blue)         }     }          func color() -> Color {         isSelected ? Color.orange : Color.blue     } } PlaygroundPage.current.setLiveView(ContentView())