Skip to content

Instantly share code, notes, and snippets.

@328
Created April 5, 2018 06:02
Show Gist options
  • Save 328/cc4b59f233e80aa54bc679632a50a333 to your computer and use it in GitHub Desktop.
Save 328/cc4b59f233e80aa54bc679632a50a333 to your computer and use it in GitHub Desktop.
Safariへのリダイレクト
import UIKit
class ViewController: UIViewController , UIWebViewDelegate {
override func viewDidLoad() {
super.viewDidLoad()
// URLを指定
let url = URL(string: "http://localhost:8080/refrects")!
if #available(iOS 10.0, *) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
} else {
UIApplication.shared.openURL(url)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment