The error message you are seeing indicates that you are trying to assign the value 'nil' to a UIView type, which is not allowed. In Swift, you cannot assign a 'nil' value to a non-optional type directly.

To solve this issue, you can make the UIView optional by using the '?' symbol after the type declaration. Here's an example:

var myView: UIView? = nil

Now, you can assign 'nil' to the optional UIView type without any issues.

swift 懒加载置nil nil cannot be assigned to type UIView

原文地址: https://www.cveoy.top/t/topic/hHtO 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录