https://developer.apple.com/documentation/foundation/measurement
Post
Replies
Boosts
Views
Activity
Why don't you try it for yourself by using the Empty publisher?
https://developer.apple.com/documentation/combine/empty
The guys from objc.io have a free video on implementing sticky headers in SwiftUI: https://talk.objc.io/episodes/S01E333-sticky-headers-for-scroll-views
@ObservedObject can only be used for objects initialized outside of the view hierarchy. Use @StateObject instead.
I don't know the reason for your error, but perhaps this very current article helps you to find it: https://www.avanderlee.com/swift/operation-couldnt-completed-error-code/
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.
In the code you posted the \ is missing from the string interpolation. Text("\(yourVar)") would be correct not Text("(yourVar)")
x and y coordinates in observation are in UnitPoints of I remember correctly. They go from 0 to 1 instead of 0 to width/height. You would have to multiply them by the width or height of the picture.
Your could observe the rate property of AVPlayer via a publisher: audioPlayer.publisher(for: .rate)
Could this be the same problem as described here?
This may not be exactly what you ask for but in the following blog are some interesting articles about swift charts:
https://nilcoalescing.com/tags/charts/
They may give you some ideas on how to solve your specific problem.
When animations or transitions fail it is usually a problem of "identity". If SwiftUI can't figure out, which views belong to an animation because one is destroyed or created. Animation does not work.
See this WWDC Talk for an explanation: https://developer.apple.com/wwdc21/10022
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.
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:..)
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)")
// ...
}