Generics call with Type T in Swift

后端 未结 7 973
逝去的感伤
逝去的感伤 2021-02-12 17:14

In my application I want to create an generic method which creates an array of object depening on the given type T.

I created the following function:

fun         


        
7条回答
  •  梦毁少年i
    2021-02-12 17:58

    Don't call it like

    object.getArray("key")
    

    Instead, leave out the "" part, like this:

    object.getArray("key")
    

    Fixed the issue for me.

提交回复
热议问题