How to add nil value to Swift Dictionary?

前端 未结 9 599
春和景丽
春和景丽 2021-01-31 01:20

I have made a request to my server in my app. And posted data something like this.Server side is waiting for all parameters even they are nil. But i couldn\'t add nil values to

9条回答
  •  半阙折子戏
    2021-01-31 01:51

    Below dictionary will hold one key with nil value

    var dict = [String:Any?]()
    dict["someKey"] = nil as Any?
    

提交回复
热议问题