草庐IT

ResultState

全部标签

swift - 未调用快速扩展中的通用覆盖

我有一个泛型enumResultState{casefound(T)}有一些扩展extensionResultState{funchello(){print("Hello")}}extensionResultStatewhereT:Collection{funchello(){print("Hello,collection")}}这些工作完美且完全符合我的预期:ResultState.found(1).hello()//prints"Hello"ResultState.found([1]).hello()//prints"Hello,collection"但是,如果它们是从另一个通用函