随着 Xcode 9 Beta 和 iOS11 预览版的最新更新,SFSafariViewControllerinit
方法发生了一些变化。
@available(iOS 11.0, *)
public init(url URL: URL, configuration: SFSafariViewController.Configuration)
@available(iOS, introduced: 9.0, deprecated: 11.0)
public convenience init(url URL: URL, entersReaderIfAvailable: Bool)
从 iOS11 开始支持一种新init
方法,而当前可用的 init 方法将被 iOS11 弃用。问题是当前方法没有暴露,也不能被覆盖。init
如果我们想使用 beta 运行现有项目,这将强制使用新方法。有没有人找到init
在新的 Xcode Beta 中使用现有方法的方法?
init
编辑:为澄清起见,这是我的子类中的方法片段
class BPSafariViewController: SFSafariViewController {
override init(url URL: URL, entersReaderIfAvailable: Bool) {
super.init(url: URL, entersReaderIfAvailable: entersReaderIfAvailable)
if #available(iOS 10.0, *) {
preferredControlTintColor = UIColor.BPUIColor()
} else {
view.tintColor = UIColor.BPUIColor()
}
}
}