This is my first contribution to the Swift Server Side community; during these months I’m evaluating Swift as backend language for server side programming. In fact it was not my first attempt, but during this year I’ve seen many improvements in all main server projects like Kitura and Vapor.
Moving away from NodeJS is a tricky decision but the advantages of moving to a modern language like Swift are tempting me since the first release.
So while it’s still a long path to the goal I’m slowly moving to see how I can make this a valuable solution.

With this goal in mind I’ve tried to port a first small contribution to the community by porting of the most famous library used in NodeJS in Swift; UAParserSwift is a port of ua-parser-js made for Swift server side. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint.

Usage of UAParserSwift is pretty simple; just allocate an UAParser object along with the User-Agent string you want to parse:

The object exposes several properties (os, device, engine, browser and cpu) which are evaluated lazily in order to improve the footprint of the library.
Each property also exposes some sub-properties which better aim to describe the object itself (for a browser you can get the engine, the name of the browser and the version).

Installation of the library can be accomplished via Swift Package Manager and its compatible with all the major Swift Server Side projects.

UAParserSwift is also listed on IBM’s Kitura Official Package Catalog.

Project page on GitHub: ➤ UAParserSwift