I'd like to extend Optional, where Wrapped is an array (with elements of any type). In other words, I want to add a function to [Any]?. I'm just not sure how to declare that. I've tried:
1.
extension Optional where Wrapped: Array
results in:
error: reference to generic type 'Array' requires arguments in <...>
2.
extension Optional where Wrapped: Array<Any>
results in:
type 'Wrapped' constrained to non-protocol type 'Array<Any>'
and various other similar declarations. Help is appreciated.
[Any]?array = (array ?? []) + [element]? IMO that's not really worth an extension (considering the workarounds you'd have to go through in order to make it work).