Filter kind is a toggle -- you can either filter by one or the other, not both. Currently this state is stored in two Bools, showDistanceFilter and showRegionFilter, which are meant to be kept in sync. That's error prone and it's not clear they can't both be true/false. This should be an enum, something like:
enum ActiveType {
case distance
case region
}
var activeType: ActiveType
Filter kind is a toggle -- you can either filter by one or the other, not both. Currently this state is stored in two Bools,
showDistanceFilter
andshowRegionFilter
, which are meant to be kept in sync. That's error prone and it's not clear they can't both be true/false. This should be an enum, something like: