Post

Replies

Boosts

Views

Activity

Reply to Swift Playgrounds .environmentObject error CreatureZoo()
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
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’22
Reply to GeometryReader problem
Without seeing your code we can only speculate: It could be possible that the size is reported as beeing zero for a short period. Change your code to prevent using a size of zero and see if that solves the problem.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’24
Reply to Returning Type Optional("Text") but I just want ("Text")
The Array.first function returns an optional value, because the array could be empty. You have to unwrap that.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’22
Reply to Swift Playgrounds .environmentObject error CreatureZoo()
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
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’22
Reply to When will Swift Playgrounds 5 come out?
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)
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to Tasks shown "alive" in Instruments display even after they should have finished.
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.
Replies
Boosts
Views
Activity
Dec ’23
Reply to how to display loop times in playground
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.
Replies
Boosts
Views
Activity
Feb ’24
Reply to how to display loop times in playground
for i in 1...5{ print("\(i) times") }
Replies
Boosts
Views
Activity
Feb ’24
Reply to Async publisher for AVPlayerItem.tracks doesn't produce values.
You have to keep a strong reference to the Task.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’24
Reply to Meet Object Capture for iOS
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
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’24
Reply to Is it possible to send from SwiftUI some sort of inout parameter or a pointer parameter to a metal shading function?
Paul Hudson has a very good video on youtube explaining the details: https://www.youtube.com/watch?v=EgzWwgRpUuw
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Apr ’24
Reply to Swift UI view in Xcode
You seems to have choosen "new project" instead of "new file"
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’24
Reply to Unable to get the current location
Did you add NSLocationWhenInUseUsageDescription to your app's plist file?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’24
Reply to iOS 18.2 playground
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.
Replies
Boosts
Views
Activity
Oct ’24
Reply to Apple playground app
Wrong topic in Swift Playgrounds and Playground Support! These are for the Swift Development tools.
Replies
Boosts
Views
Activity
Oct ’24
Reply to GeometryReader problem
Without seeing your code we can only speculate: It could be possible that the size is reported as beeing zero for a short period. Change your code to prevent using a size of zero and see if that solves the problem.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to indices(where:) Swift Playgrounds Issue: "Cannot call value of non-function type Range<Int>"
I already reported a similar bug to apple on Jan 9, 2021 – FB8965796. There was never any reaction or fix: The function Swift.Collection.remove(atOffsets:) is not available in playgrounds
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jan ’25