blsage / iPages

Quickly implement swipable page views.
170 stars 16 forks source link

Crush and Swipes #10

Closed kfoau9h39 closed 3 years ago

kfoau9h39 commented 3 years ago
iPages {
            ForEach(0..<10) {
                Text("Index \($0)")
            }
        }

Will swipe itself

and if I set array in forEach I get error:

Fatal error: Index out of range: file Swift/ContiguousArrayBuffer.swift, line 444

Снимок экрана 2020-11-02 в 15 53 05
kfoau9h39 commented 3 years ago

Error reproduced when I set empty array.

Why iPages swipes views itself?

kfoau9h39 commented 3 years ago

iPages makes duplicates of views

blsage commented 3 years ago

Hi,

If you are talking about the unwanted animation that happens when the parent's state changes, that is now fixed. I tested your code, and it runs without bugs now.

Regarding your index out of bounds error, make sure not to programmatically change the pages binding to an out of bounds value. We discussed allowing out of bounds numbers as wrapping, but in the end decided it would cause more issues than fix them. If you would like this feature, let me know.

Also if you don't use your own selection binding, this shouldn't ever be an issue.

If you have any other code producing errors, definitely open more issues. Just let me know 😄