Post

Replies

Boosts

Views

Activity

Reply to Looking for swift playgrounds for iPadOS 15
Unfortunately this is a general problem with the App Store. Only if you already once downloaded an older version of Swift Playgrounds on your account you can load this version again on older devices that don't run the current version. If you try to download an App for the first time, only the newest version will be offered and users of older devices have a problem.
Feb ’23
Reply to Non-sendable Warning for NotificationCenter.default.notifications(named: ...) in for await
Unfortunately in the meantime FB 11722934 was closed by Apple: "Investigation completed - functional capability according to current design given" (translated from the german status message on the Feedback web page) In the best interpretation this means the problem is known to behave this way until Swift 6 compatible frameworks come out? But this is not really a helpful answer. I even tried to ask about this problem in an Ask Apple: Swift session but it was not covered in the topics answered.
Dec ’22
Reply to CSV to SwiftUI
First, you have to separate the reading of the data into a model from the rendering the model data into the GUI! ForEach is only usable to render existing model data, you can't read or create the data in this loop. This is not the way SwiftUI works. For reading table data see TabularData data framework, Swift RegEx or String.split(separator:..)
Dec ’22
Reply to Newbie needs help with SwiftUI
You are still thinking to much in "imperative programming" terms. SwiftUI is "declarative". The var body of a View is no regular Swift function, it is a @ViewBuilder. This means only a subset of Swift is allowed there. Like generating Views and some conditional statements. Regular "imperative" code like weightKg = weight/2.205 is not allowed. You have to derive all of the View's state from your model. Some Views like Button have closures which can contain "imperative" code. You can do/cause calculations there or in your model. Better would be to bind the weight variable to the input field of a View and make a calculated var for the other weight which is used by a Text for example. @State var weight = 175.0 var weightKg:Double{ return weight/2.205 } var body:some View{ // ... SomeInput($weight) // SomeInput is not really an existing type, you would have to look up the correct syntax for TextField for example Text("weight in kg: \(weightKg)") // ... }
Dec ’22