티스토리 뷰

반응형

안녕하세요 오늘은 제목 그대로 입니다.

말이 필요없습니다.

아래와 같이 했습니다.


 //inside scope use this
 let myUrl = "http://www.google.com"
    if let url = URL(string: "\(myUrl)"), !url.absoluteString.isEmpty {
        UIApplication.shared.open(url, options: [:], completionHandler: nil)
    }

    // or outside scope use this
    guard let url = URL(string: "\(myUrl)"), !url.absoluteString.isEmpty else {
       return
    }
     UIApplication.shared.open(url, options: [:], completionHandler: nil)

그냥

UIApplication.shared.openURL(url) =>  UIApplication.shared.open(url, options: [:], completionHandler: nil

변경했습니다.

반응형
댓글