How to add nil value to Swift Dictionary?

前端 未结 9 478
春和景丽
春和景丽 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:49

    You can use the Optional type

    var postDict = ["pass": 123, "name": "ali", "surname": Optional()]
    

提交回复
热议问题