Closed chinyaev closed 4 years ago
Hello! thank you for your solution, but I cannot use it with dinamic array.
My code ` import SwiftUI import Pages
struct Car { var model: String }
struct CarsView: View { @State var cars = [Car(model: "Ford"), Car(model: "Ferrari")] @State var index: Int = 0
var body: some View { VStack { GeometryReader { g in ModelPages(self.cars, currentPage: self.$index) {index, car in VStack(alignment: .leading) { Text(car.model).font(.title) Button(action: { self.cars.append(Car(model: "BMW")) }) { Text("Add").font(.title) } } } } } }
} `
When I added element it stop work and element doesn't add.
Update your version of Pages, it should be fixed now.
Hello! thank you for your solution, but I cannot use it with dinamic array.
My code ` import SwiftUI import Pages
struct Car { var model: String }
struct CarsView: View { @State var cars = [Car(model: "Ford"), Car(model: "Ferrari")] @State var index: Int = 0
} `
When I added element it stop work and element doesn't add.