import FakeUserAgent
FakeUserAgent.shared.pickALot(count: 5, browser: .chrome, filter: { userAgent in
return userAgent.contains("Macintosh; Intel Mac OS X 10_")
}, completion: { result in
print(result.joined(separator: "\n"))
})
Will show:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.66 Safari/535.11
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.803.0 Safari/535.1
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.65 Safari/535.11
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.68 Safari/534.24
FakeUserAgent
Up-to-date simple useragent faker with real world database in Swift, inspired by fake-useragent.
Features
Example
To run the example project, clone the repo, and run
pod install
from the Example directory first.Requirements
Installation
CocoaPods
FakeUserAgent is available through CocoaPods. To install it, simply add the following line to your Podfile:
Swift Package Manager
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the Swift compiler.
Once you have your Swift package set up, adding FakeUserAgent as a dependency is as easy as adding it to the
dependencies
value of yourPackage.swift
.Use
Will show:
Update
"internet explorer"
to"internetExplorer"
in file;}{
to,
in file;FakeUserAgent/Assets
Author
EyreFree, eyrefree@eyrefree.org
License
FakeUserAgent is available under the MIT license. See the LICENSE file for more info.