Check If Swift Dictionary Contains No Values?

后端 未结 4 1056
借酒劲吻你
借酒劲吻你 2021-01-02 07:10

So I\'m making a to-do list app, and I want the user to be notified when all of the shopping items have been deleted. I have a dictionary that contains the String:store as a

4条回答
  •  悲&欢浪女
    2021-01-02 07:32

    You can just use isEmpty

    var dict: Dictionary = [:]
    
    var result = dict.isEmpty
    

    result will be true

提交回复
热议问题