Wrong topic in Swift Playgrounds and Playground Support! These are for the Swift Development tools.
Post
Replies
Boosts
Views
Activity
This category is only meant for discussions about:
Share playground data, manage live views, and control the execution of a playground in Swift Playgrounds using Playground Support.
Did you add NSLocationWhenInUseUsageDescription to your app's plist file?
You seems to have choosen "new project" instead of "new file"
Paul Hudson has a very good video on youtube explaining the details:
https://www.youtube.com/watch?v=EgzWwgRpUuw
This functionality is now included in the Reality Composer App for iOS/iPadOS. Did you try that?
https://apps.apple.com/de/app/reality-composer/id1462358802
You have to keep a strong reference to the Task.
for i in 1...5{
print("\(i) times")
}
The view on the right side only displays the current or the latest result of an expression.
To see the output of a print statement you have to open the console in Xcode.
Unfortunately not, ...
but yesterday I heard someone talk about retain cycles in SwiftUI and closures
and now that you ask, this may actually be the problem here: Task's closure retains some values. Try using some weak captures could be the solution.
You can request and participate in a testflight beta test of Swift Playgrounds 4.2 on developer.apple.com (free developer account seems to be sufficient to participate)
You have to create the environment object at the top level of your hierarchy and inject it into your topmost view using .environmentObject(yourEnvironmentObject), where yourEnvironmentObject ist the object you created.
See the following article: https://www.hackingwithswift.com/quick-start/swiftui/how-to-use-environmentobject-to-share-data-between-views
The Array.first function returns an optional value, because the array could be empty.
You have to unwrap that.