Skip to content
Discussion options

You must be logged in to vote

Hi @alinless, I just checked in vanilla SwiftUI and apparently that is the behavior there too. I thought for some reason it would animate but that is not the case.

Here's a sample for you to test:

import SwiftUI

class Model: ObservableObject {
  @Published var numbers: [Int] = []

  func push() {
    self.numbers.append(.random(in: 1...100))
  }
  func popPush() {
    self.numbers.removeLast()
    self.numbers.append(.random(in: 1...100))
  }
}

struct ContentView: View {
  @ObservedObject var model = Model()
  var body: some View {
    NavigationStack(path: self.$model.numbers) {
      Button("Push") {
        self.model.push()
      }
      .navigationDestination(for: Int.self) { int in

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@mbrandonw
Comment options

@alinless
Comment options

@mbrandonw
Comment options

@mbrandonw
Comment options

Answer selected by alinless
@alinless
Comment options

@mbrandonw
Comment options

@alinless
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants