-1

I'm trying to put the following in a do try catch block, but I always end up getting a coding error. Can someone help me?

 let here = CGRect(x: UIScreen.main.bounds.width - 30, y: 80, width: 10, height: 10)
        DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
            let popTip = PopTip()
            popTip.show(text: "Font Sizes", direction: .down, maxWidth: 200, in: (self.navigationController?.view)! , from: here, duration: 3)
        }
4

1 回答 1

1

您的问题是您没有任何实际引发错误的内容(即标有try)。我无法完全理解您在评论中所说的内容,但是我相信您可以在没有do-catch子句的情况下解决此问题,但可以使用guard-let检查 if self.navigationController.viewis的语句nil如果是nil,只是return功能。

于 2021-01-02T17:11:49.060 回答