diff --git a/Sources/SwiftUIPager/Page.swift b/Sources/SwiftUIPager/Page.swift index 1611fb8..b2c8d71 100644 --- a/Sources/SwiftUIPager/Page.swift +++ b/Sources/SwiftUIPager/Page.swift @@ -37,7 +37,7 @@ public class Page: ObservableObject { var totalPages: Int = Int.max { didSet { // reset in case there's a deletion - self.index = index + self.index = totalPages > 0 ? index : 0 } }