Entalpi
Entalpi

Reputation: 2033

Change tintcolor of SFSafariViewController?

As the title says; how does one change the overall tint color of the new, in iOS 9, SFSafariViewController?

Upvotes: 23

Views: 6649

Answers (3)

Douglas
Douglas

Reputation: 1

There's no need for that.

Just use CSafariWebKit and set the Color you want in BarTintColor and the TintColor:

So, you won't need to check if it's available. The frameworks does it for you

let vc = SafariViewController(url: url, barTintColor: nil, tintColor: nil)
vc.presentSafari(fromViewController: self, whenDidFinish: nil)

Upvotes: 0

Lucas Eduardo
Lucas Eduardo

Reputation: 11675

Some news from iOS 10: now we have two properties to control the overall looks of the SFSafariViewController

doc

source: link

The only downside is, of course, it's not available for older versions.

if #available(iOS 10.0, *) {
    safariVC.preferredBarTintColor = .black
    safariVC.preferredControlTintColor = .white
} else {
    safariVC.view.tintColor = .someColor
}

Upvotes: 56

Entalpi
Entalpi

Reputation: 2033

It's a property of the view, safariVC.view.tintColor = UIColor.someColor()

Upvotes: 22

Related Questions