-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
Sometimes I get crash on
mutating func dismiss(count: Int = 1) {
assert(count >= 0)
var index = endIndex - 1
var dismissed = 0
while dismissed < count, index + 1 > rootIndex {
if self[index].isPresented {
dismissed += 1
}
index -= 1
}
goBackTo(index: index)
}I suggest to use
self[safe: index]?.isPresented == true insteadextension Collection {
/// Returns the element at the specified index if it is within bounds, otherwise nil.
subscript(safe index: Index) -> Element? {
indices.contains(index) ? self[index] : nil
}
}this will eliminate crashes.
Workaround - I do preconditions check on app side for now
Metadata
Metadata
Assignees
Labels
No labels