See the subsections below for details about the different installation methods.
pod 'WebKitUserAgent'
cd {PATH_TO_PROJECT}
pod install
File
→ Add Packages...
https://github.com/dmytriigolovanov/webkit-user-agent
Dependency Rule
to Up to Next Major Version
Add Package
Import library to needed swift file.
import WebKitUserAgent
Library provides 3 variants of usage.
WKWebView
.example:
var webView: WKWebView
...
DispatchQueue.main.async {
let userAgent = webView.userAgent
}
}
WKWebView
.example:
WKUserAgent.fetchDefault { userAgent in
}
applicationName
.
Application name is additional part for User Agent, which will be added at the end of original WebView's User Agent.
Provided overrideDefaultApplicationName
parameter for using/rewriting default applicationName
from WKWebViewConfiguration
.
(By default this parameter is false
)example:
let applicationName = "EXAMPLE/1.0.0"
WKUserAgent.fetch(
withApplicationName: applicationName,
overrideDefaultApplicationName: true
) { userAgent in
}
The contents of this repository are licensed under the MIT License.
link |
Stars: 6 |
Last commit: 1 year ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics