This one has never supposed to work. If you return some type from the function, you have to be clear which exact type it returns. This method is just confusing for Swift types system - it can return any shape, but the function requires other way around. some
keyword just allows to hide exact type, so you can change it later freely. But you are trying to get any
and some
work in the same way, while they are different things with different behaviour.
Official docs on the matter a bit incomplete, I think, so it is better to read proposal which has introduced some
keyword: swift-evolution/proposals/0244-opaque-result-types.md at main · apple/swift-evolution · GitHub
There is also a nice starting post (and thread in general) that follows opaque types - Improving the UI of generics - and get even more understanding.
Finally, the most recent post - Swift for C++ Practitioners, Part 5: Type erasure & metatypes | Doug's Compiler Corner - which has only Swift code in it, so even if you have no notion of C++, that is not an issue. I have found it being extremely descriptive on the any
and some
keywords and being a great explanation just for Swift users.
These links will definitely be helpful to understand what is going on here and when to use what.