Comparing non-optional Any to nil is always false?

前端 未结 2 1492
太阳男子
太阳男子 2021-01-18 12:54

I\'m iterating through a dictionary of [String: Any], looking for nils, so I can replace them with NSNull for a JSON write. My precomp

2条回答
  •  深忆病人
    2021-01-18 13:35

    if(object_getClass(yourVariable)?.description() == "NSNull") can be one of the way to check.

提交回复
热议问题