Closed Clem23 closed 3 years ago
Could be a regression as on January 15th your code change from that:
/// Work around to avoid @State keeps wrong value
var page: Int {
return min(pagerModel.page, numberOfPages - 1)
}
to that:
/// Current page index
var page: Int {
pagerModel.index
}
Nevertheless the TotalPages was not updated...
Hi @Clem23 , I made some changes in January to use an ObservableObject
rather than individual State
variables.
I'm confused by your second, does that mean this is still reproducible but the suggested fix doesn't work any more?
Describe the bug When SwiftUIPager is configure as LoadingPolicy = lazy and removing the last item. It seems to works fine the first time. But on second removing of the last element, Pager become empty.
When SwiftUIPager is configure as LoadingPolicy = eager then removing the last element make the Pager to scroll on the first element.
More-over, Page.Index and Page.TotalPages do not reflect the deletion.
Here is my Fix On file PagerContent+Helper.swift
You will perhaps find a better fix but this one do the job. (Perhaps it could be better to observe changes on data)