Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

investigate index out of bounds in WatchlistVC #119

Open
niksauer opened this issue Jun 10, 2018 · 0 comments
Open

investigate index out of bounds in WatchlistVC #119

niksauer opened this issue Jun 10, 2018 · 0 comments
Labels

Comments

@niksauer
Copy link
Owner

intermediate solution:

guard let currency = displayedCurrencies[safe: indexPath.row] else {
    return false
}
    
return !requiredCurrencies.contains(where: { $0.isEqual(to: currency)})

where [safe:]:

extension Collection where Indices.Iterator.Element == Index {
    subscript (safe index: Index) -> Iterator.Element? {
        return indices.contains(index) ? self[index] : nil
    }
}
@niksauer niksauer added the bug label Jun 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant