Skip to main content

This will be fixed in the next build. The error I'm getting is EXC_BREAKPOINT UNKNOWN which as far as I can tell is Swift's way of saying it has no idea what went wrong. I suspect it's similar to this bug where casting an array failed.

The original code looks like this:

func transformItems(items:[AnyObject], type:StacManTagPreferenceType?) -> [StacManTagPreference] {
    
    let preferences = items as [StacManTagPreference]
    if type != nil {
        return preferences.filter({ $0.tagPreferenceType == type! })
    } else {
        return preferences
    }
}

I think this will fix it:

let preferences = items.map { $0 as StacManTagPreference }

But I really don't want to crash on what really is an optional behavior so I'm doing this:

let preferences = items.map { $0 as? StacManTagPreference } .filter { $0 != nil } .map { $0! }