I need to find a way to make the user agents of WKWebView and Safari match the app that I am working on.
Post
Replies
Boosts
Views
Activity
I need to get Safari's user agent at runtime in my simulator for iPad.
I need to get the user agent of safari during run-time on my app.
I need to get my iPad to use the desktop version of a user agent however so far this is not working
let webConfiguration = WKWebViewConfiguration()
if #available(iOS 13.0, *) {
webConfiguration.defaultWebpagePreferences.preferredContentMode = .desktop
} else {
// Fallback on earlier versions
}
let webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.evaluateJavaScript("navigator.userAgent") { result, _ in
var userAgent: UIAlertController!
userAgent = UIAlertController(title: "user agent", message: result as? String, preferredStyle: .alert)
userAgent.addAction(UIAlertAction(title: "Ok", style: .default, handler: nil))
UIApplication.shared.windows.first?.rootViewController?.present(userAgent, animated: false, completion: nil)
}
I am wondering because I need to emulate the same exact out of the box behavior of that device for my app.
Is there a way to get that in Xcode? Xcode just seems to jump me through word results and does not tell me which search number each word is.
I want to know if there is an easy of doing this.
Just curious if any of the default functions get called more than once.
So, I just upgraded from Xcode 11 to Xcode 12, and the first thing that I noticed is that they took away the toggle sidebars on the right. Now the only one on the right just shows the file details and target memberships. Is there a way to get console bar (the bottom one)? Also is there a way to make it look the way that it was in Xcode 11?
Why can't I just release a build without them?
I am a huge fan of dark mode, and I am wondering if there is a way to have dark mode on apps that have not implemented it yet.
Whenever I open the view hierarchy of my app to see which classes I should edit, there is no way for me to just tap in the name and go to the class that I want to edit. Is there a way to do this?
Is there a way to find the line in which I performed my latest change in Xcode, even in other files?
Sometimes I commit changes that I forget about and would like to find those right the way.
I want to italicize only one word of a string in a button. Is there a way to do this?
I have been looking all over the internet and cannot figure out a way of doing this.