2016-10-20 43 views
-2

的後衛線拋出使用傳統的SWIFT這個錯誤我如何返回,如果咱們不拆開包裝,使用傳統的SWIFT

:初始值設定條件結合必須有 可選類型,而不是「的UIView」

private func animateDismissal(context: UIViewControllerContextTransitioning) { 

    guard let containerView = context.containerView() else { 
     return 
    } 
... 

如果我們不打開包裝,該如何返回?

回答

5

context.containerView()不是可選的,所以它不能爲零。所以不需要guard或解開它。

相關問題