Swift Optional of Optional

后端 未结 2 562
孤独总比滥情好
孤独总比滥情好 2020-12-11 09:00

For a project of mine, I have to create a proxy AppDelegate that will forward calls to a another AppDelegate.

UIApplicationDelegate havs a var window: UIWindow

2条回答
  •  时光说笑
    2020-12-11 09:42

    The declaration of the property is

    optional var window: UIWindow? { get set }
    

    The optional in the beginning means that the property doesn't have to be there at all, that's the second ?.

    UIApplicationDelegate is a protocol, the class that implements it doesn't have to implement everything.

提交回复
热议问题