Swiftpack.co - squarefrog/UIDeviceIdentifier as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by squarefrog.
squarefrog/UIDeviceIdentifier 2.3.0
UIDeviceHardware is a class which allows querying of the current users device, and returns a human formatted string.
⭐️ 238
🕓 4 weeks ago
.package(url: "https://github.com/squarefrog/UIDeviceIdentifier.git", from: "2.3.0")


UIDeviceHardware is a class originally created in a gist by Jaybles. It allows querying of the current users device, and returns a human formatted string.

It is written as a class method, to allow use without direct instantiation.

⚠️ Note

I don't use this helper much anymore, so I'm not keeping up to date with device models. While I welcome Pull Requests to update the model, I'd recommend moving over to something more modern, like DeviceKit.


// "iPhone 5C (GSM)"
NSString *platformString = [UIDeviceHardware platformString];
// "iPhone 5C"
NSString *simpleString = [UIDeviceHardware platformStringSimple];


This class can be installed with Swift Package Manager, Cocoapods, or by directly copying the files into your source code.

Swift Package Manager

Add the package to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/squarefrog/UIDeviceIdentifier", .upToNextMajor(from: "1.7.0"))

Then import as follows:

// ObjC
@import UIDeviceIdentifier;
// Swift
import UIDeviceIdentifier


Add the cocoapod to your Podfile:

pod 'UIDeviceIdentifier', :git => 'https://github.com/squarefrog/UIDeviceIdentifier.git'

Import the file into your Objective-C file:

// ObjC
#import <UIDeviceIdentifier/UIDeviceHardware.h>

Copying the files

Copy UIDeviceHardware.{h/m} into your project. Then just import the header:

#import "UIDeviceHardware.h"


UIDeviceHardware is available under the MIT licence. See the LICENCE file for more info.


Stars: 238
Last commit: 4 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics