aStoryboard.instantiateViewControllerWithIdentifier(“myid”) returns nil but not nil in lldb

耗尽温柔 提交于 2019-11-29 17:23:25
Jurasic

"viewController is allocated with memory. What how? If I manually add this in lldb then it has memory if I don't then it doesn't have memory and it's nil for the unit test."

In Swift nil doesn't mean the same as Objective-C. It's not a pointer to NULL. It just mean absence of proper value. More information here: null / nil in swift language

So answering your question: it's fine to have memory for nil variable.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!