Post

Replies

Boosts

Views

Activity

Comment on Reset SwiftUI animation for another step.
I noticed you said enqueue, which was something I wasn't familiar with. Looking into that, I added DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { move = model.nextMove()} to the completion block. Since the onChange block is guarded by a nil value for currentMove, It now works. The updates happen until nextMove() returns nil indicating the user has to make a choice. Thanks for you help, it is really appreciated.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Comment on
I did that tutorial, plus others on the web. I am using the version shown in the second example. withAnimation(.easeIn()){animate=true}completion:{move=nil;animate=false}. An onChange detects that there is a new move and sets animate to true so that the next move is animated. If I update the move manually from a button (i.e. after the completion block), it works. However, if I I update the value in the completion block (i.e nextMove() instead of nil, then the onChange doesn't fire.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Comment on Reset SwiftUI animation for another step.
Further refinement, I just used async, and I works exactly as I wanted it to.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25
Comment on Reset SwiftUI animation for another step.
I noticed you said enqueue, which was something I wasn't familiar with. Looking into that, I added DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { move = model.nextMove()} to the completion block. Since the onChange block is guarded by a nil value for currentMove, It now works. The updates happen until nextMove() returns nil indicating the user has to make a choice. Thanks for you help, it is really appreciated.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25
Comment on
I did that tutorial, plus others on the web. I am using the version shown in the second example. withAnimation(.easeIn()){animate=true}completion:{move=nil;animate=false}. An onChange detects that there is a new move and sets animate to true so that the next move is animated. If I update the move manually from a button (i.e. after the completion block), it works. However, if I I update the value in the completion block (i.e nextMove() instead of nil, then the onChange doesn't fire.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25
Comment on Xcode 13 and Linux Makefile
Thanks. It was step 7 and 8 that I was lost on. It works fine now.
Replies
Boosts
Views
Activity
Jan ’22