Skip to content

UIDeviceHardware is a class which allows querying of the current users device, and returns a human formatted string.

License

Notifications You must be signed in to change notification settings

squarefrog/UIDeviceIdentifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

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.

Usage

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

Installation

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

Cocoapods

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"

Licence

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

About

UIDeviceHardware is a class which allows querying of the current users device, and returns a human formatted string.

Resources

License

Stars

Watchers

Forks

Packages

No packages published