ios9 - Swift 2.1 - SFSafariViewController
NickName:Mike Purcell Ask DateTime:2016-08-17T03:31:55

ios9 - Swift 2.1 - SFSafariViewController

I'm looking to use the SFSafariViewController and have it automatically load a website when the app is opened. Is this possible?

What I have so far (brand new single ios app):

// ViewController.swift
let urlString = "https://stackoverflow.com"

@IBAction func launchSFSafariViewController(sender: AnyObject) {
    if let url = NSURL(string: urlString) {
        let vc = SFSafariViewController(URL: url, entersReaderIfAvailable: true)
        vc.delegate = self

        presentViewController(vc, animated: true, completion: nil)
    }
}

How do I connect the action to the main view controller via the storyboard? All the articles I see only discuss connecting a button to an action.

Copyright Notice:Content Author:「Mike Purcell」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/38983030/ios9-swift-2-1-sfsafariviewcontroller

More about “ios9 - Swift 2.1 - SFSafariViewController” related questions

ios9 - Swift 2.1 - SFSafariViewController

I'm looking to use the SFSafariViewController and have it automatically load a website when the app is opened. Is this possible? What I have so far (brand new single ios app): // ViewController.s...

Show Detail

SFSafariViewController cookies

I understand that as of iOS9 you should be able to read cookies with SFSafariViewController. If I set a cookie on my page in JS using the following: var dd = new Date(Date.now() + 1000 * 60 * 60 ...

Show Detail

Sharing cookies across apps in iOS9

I've heard that it's possible to share cookies(obviously from the same source) across apps in iOS9 using SFSafariViewController. How do I do that? I know that loading a webpage with

Show Detail

Facebook iOS9 Different Access Token

After updating my project and respective pods for iOS9 and Swift 2.1, I've been dealing with a few oddities in the Facebook SDK. I have upgraded to FBSDK 4.9.1 - tried, 4.9.0 and currently running...

Show Detail

SFSafariViewController notification when token received

Converting the code in the following swift sample to C# (Xamarin) to notify the App when Paypal Token is received inside SFSafariViewController but it does not fire the method. https://github.com/...

Show Detail

SFSafariViewController language is not updated

I'm working on a project in swift 2.0. The App is for two languages chinese and english. I'm using the SFSafariViewController to open the url. Now the problem is when i choose the english language...

Show Detail

Present SFSafariViewController from not rootController swift

I have UINavigationController, firstViewController (rootController for navigationController), secondViewController and SFSafariViewController. If I present SFSafariViewController from

Show Detail

SFSafariViewController using Objective-C

What is the best way to implement SFSafariViewController using Objective-C. I currently have a UITableView and each of them leads to a different website. May I know how can I code each of them to l...

Show Detail

Caching websites for offline use with SFSafariViewController

I am using the following code to display a website in my app. let webVC = SFSafariViewController(url: myUrl) present(webVC, animated: true) Now, I want to add offline reading. I know that iOS ha...

Show Detail

Swift - Custom color theme and SFSafariViewController

I am applying custom colors to several views, like this: let uiView = UIView.appearance() uiView.backgroundColor = .black This changes the UIView colors as I expected but later in the app I am

Show Detail