Is a giant switch/case the right way to convert NSNumber to a generic type `T`?

Edit (2 :): so this seems to work:

    func convert<T>(_ type: T.Type = T.self) -> T {
        self as! T
    }

I didn't know you can cast NSNumber to something...

I need this convert for this:

struct AddDecimalAndDoneKeyboardToolbar<T>: ViewModifier {
...
}

So convert need to work with whatever T is that NSNumber can produce, that's in that giant switch/case.

See: How to convert a String to generic T, where T is unconstrainted? - #3 by young