DeviceKit is a value-type replacement of UIDevice.

Overview

GitHub license CocoaPods Compatible Carthage Compatible codecov CocoaPods Maintainability Platform

Branch Build Status Versions
master Build Status ≥ 2.0
Swift 4 - 4.2 Build Status ≥ 1.3 < 1.13
Swift 3 Build Status ≥ 1.0 < 1.3
Swift 2.3 Build Status < 1.0

DeviceKit is a value-type replacement of UIDevice.

Current version 4.5.2

See our detailed changelog for the latest features, improvements and bug fixes.

Features

  • Equatable
  • Device identification
  • Device family detection
  • Device group detection
  • Simulator detection
  • Battery state
  • Battery level
  • Various device metrics (e.g. screen size, screen ratio, PPI)
  • Low Power Mode detection
  • Guided Access Session detection
  • Screen brightness
  • Display Zoom detection
  • Detect available sensors (Touch ID, Face ID)
  • Detect available disk space
  • Apple Pencil support detection

Requirements

  • iOS 9.0+ (linking against iOS 9.3 required)
  • tvOS 9.0+ (linking against tvOS 9.2 required)
  • watchOS 2.0+

Installation

DeviceKit can be installed in various ways.

CocoaPods

Swift 5

pod 'DeviceKit', '~> 4.0'

iOS 8.0 support

pod 'DeviceKit', '3.2'

Swift 4.0 - Swift 4.2

pod 'DeviceKit', '~> 1.3'

Swift 3

pod 'DeviceKit', '~> 1.2.3'

Swift 2.3 (Unsupported)

pod 'DeviceKit', :git => 'https://github.com/devicekit/DeviceKit.git', :branch => 'swift-2.3-unsupported'

Swift Package Manager

Swift 5

dependencies: [
    .package(url: "https://github.com/devicekit/DeviceKit.git", from: "4.0.0"),
    /// ...
]

iOS 8.0 support

dependencies: [
    .package(url: "https://github.com/devicekit/DeviceKit.git", from: "3.2.0"),
    /// ...
]

Carthage

Swift 5

github "devicekit/DeviceKit" ~> 4.0

iOS 8.0 support

github "devicekit/DeviceKit" ~> 3.2

Swift 4.0 - Swift 4.2

github "devicekit/DeviceKit" ~> 1.3

Swift 3

github "devicekit/DeviceKit" ~> 1.2.3

Swift 2.3 (Unsupported)

github "devicekit/DeviceKit" "swift-2.3-unsupported"

Manually

To install it manually, drag the DeviceKit project into your app project in Xcode. Or add it as a git submodule by running:

$ git submodule add https://github.com/devicekit/DeviceKit.git

Usage

First make sure to import the framework:

import DeviceKit

Here are some usage examples. All devices are also available as simulators:

.iPhone6 => .simulator(.iPhone6)
.iPhone6s => .simulator(.iPhone6s)

You can try these examples in Playground.

Note:

To try DeviceKit in the playground, open the DeviceKit.xcworkspace and build DeviceKit.framework for any simulator first by selecting "DeviceKit" as your current scheme.

Get the Device You're Running On

let device = Device.current

print(device)     // prints, for example, "iPhone 6 Plus"

if device == .iPhone6Plus {
  // Do something
} else {
  // Do something else
}

Get the Device Family

let device = Device.current
if device.isPod {
  // iPods (real or simulator)
} else if device.isPhone {
  // iPhone (real or simulator)
} else if device.isPad {
  // iPad (real or simulator)
}

Check If Running on Simulator

let device = Device.current
if device.isSimulator {
  // Running on one of the simulators(iPod/iPhone/iPad)
  // Skip doing something irrelevant for Simulator
} 

Get the Simulator Device

let device = Device.current
switch device {
case .simulator(.iPhone6s): break // You're running on the iPhone 6s simulator
case .simulator(.iPadAir2): break // You're running on the iPad Air 2 simulator
default: break
}

Make Sure the Device Is Contained in a Preconfigured Group

let groupOfAllowedDevices: [Device] = [.iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .simulator(.iPhone6), .simulator(.iPhone6Plus),.simulator(.iPhone6s),.simulator(.iPhone6sPlus).simulator(.iPhone8),.simulator(.iPhone8Plus),.simulator(.iPhoneX),.simulator(.iPhoneXS),.simulator(.iPhoneXSMax),.simulator(.iPhoneXR)]

let device = Device.current
 
if device.isOneOf(groupOfAllowedDevices) {
  // Do your action
}

Get the Current Battery State

Note:

To get the current battery state we need to set UIDevice.current.isBatteryMonitoringEnabled to true. To avoid any issues with your code, we read the current setting and reset it to what it was before when we're done.

if device.batteryState == .full || device.batteryState >= .charging(75) {
  print("Your battery is happy! 😊")
}

Get the Current Battery Level

if device.batteryLevel >= 50 {
  install_iOS()
} else {
  showError()
}

Get Low Power mode status

if device.batteryState.lowPowerMode {
  print("Low Power mode is enabled! 🔋")
} else {
  print("Low Power mode is disabled! 😊")
}

Check if a Guided Access session is currently active

if device.isGuidedAccessSessionActive {
  print("Guided Access session is currently active")
} else {
  print("No Guided Access session is currently active")
}

Get Screen Brightness

if device.screenBrightness > 50 {
  print("Take care of your eyes!")
}

Get Available Disk Space

if Device.volumeAvailableCapacityForOpportunisticUsage ?? 0 > Int64(1_000_000) {
  // download that nice-to-have huge file
}

if Device.volumeAvailableCapacityForImportantUsage ?? 0 > Int64(1_000) {
  // download that file you really need
}

Source of Information

All model identifiers are taken from the following website: https://www.theiphonewiki.com/wiki/Models or extracted from the simulator app bundled with Xcode.

Contributing

If you have the need for a specific feature that you want implemented or if you experienced a bug, please open an issue. If you extended the functionality of DeviceKit yourself and want others to use it too, please submit a pull request.

Contributors

The complete list of people who contributed to this project is available here. DeviceKit wouldn't be what it is without you! Thank you very much! 🙏

Comments
  • Breaking changes for 2.0

    Breaking changes for 2.0

    Fixes https://github.com/dennisweissmann/DeviceKit/issues/149 Closes https://github.com/dennisweissmann/DeviceKit/issues/130 Fixes https://github.com/dennisweissmann/DeviceKit/issues/167 Fixes https://github.com/dennisweissmann/DeviceKit/issues/165 Closes https://github.com/devicekit/DeviceKit/issues/174 (Both Swift 5 and the @unknown in switch) Closes https://github.com/devicekit/DeviceKit/issues/159


    Fixes https://github.com/dennisweissmann/DeviceKit/pull/164 not being defined in the gyb file. Fixes https://github.com/dennisweissmann/DeviceKit/pull/166 not being defined in the gyb file.


    Changelog

    Breaking changes

    • The original Device() constructor has been made private in favour of using Device.current to match UIDevice.current.
    • The enum values for the iPhone Xs, iPhone Xs Max and iPhone Xʀ have been renamed to be .iPhoneXS, .iPhoneXSMax and .iPhoneXR to match proper formatting.
    • .description for the iPhone Xs, iPhone Xs Max and iPhone Xʀ have been changed to contain small caps formatting for the s and the ʀ part.
    • .description for the iPad 5 and iPad 6 have been changed to the proper names; iPad (5th generation) and iPad (6th generation).
    • .name, .systemName, .systemVersion, .model, .localizedModel, .batteryState and .batteryLevel will now all return nil when you try to get its value when the device you are getting it from isn't the current one. (eg. Device.iPad6.name while running on iPad 5)

    New features

    • Updated to Swift 5!
    • New .allDevicesWithRoundedDisplayCorners and .hasRoundedDisplayCorners values to check if a device has rounded display corners. (eg. iPhone Xs and iPad Pro (3rd generation))
    • new .allDevicesWithSensorHousing and .hasSensorHousing values to check if a device has a screen cutout for the sensor housing. (eg. iPhone Xs)

    Bugfixes

    • .isPad and .isPhone are now giving correct outputs again.
    opened by Zandor300 22
  • Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift.

    Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift.

    I tried to install it through cocoapod. Installation went successful but my xcode force me to convert swift code i tried doing it later i got 18 errors. Then i deintegrate it pod from my project and again tried installing it. However, process was successful again but this time i didnt choose conversion of swift syntax on which i got this error: " Check dependecies: Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly." What should i do next ?

    opened by Mozoee 15
  • Add support for new 2019 September devices.

    Add support for new 2019 September devices.

    Adds support for the new devices announced at the September 2019 event:

    • iPhone 11
      • iPhone12,1
    • iPhone 11 Pro
      • iPhone12,3
    • iPhone 11 Pro Max
      • iPhone12,5
    • Apple Watch Series 5
      • Watch5,1 and Watch5,3 for 40mm
      • Watch5,2 and Watch5,4 for 44mm
    • iPad (7th generation) (aka iPad 10.2 inch)
      • Unknown currently. Feel free to post it below if you have information.

    Fixes #199

    opened by Zandor300 11
  • added orientaiton enum to device

    added orientaiton enum to device

    Added orientation enum to get device orientation

    let device = Device()
    switch device.orientation {
            case .landscape:
             //landscape
             break
    
            case .portrait:
            // portrait
            break
     }   
    

    fixes #87

    opened by mumer92 11
  • Add disk space properties

    Add disk space properties

    Hey @dennisweissmann following on from #48 , here's a quick first stab at adding disk space related properties. I'm not sure about the use of disk in the property names, seeing as spinning rust is becoming but a distant memory. The tests are pretty useless too but it's a start.

    in progress 
    opened by jamesbebbington 11
  • Check if device supports FaceID/TouchID?

    Check if device supports FaceID/TouchID?

    Hi @dennisweissmann, I'm using it since very long time and I would really like to thank you for providing this wonderful library and your frequent updates on it!

    I would like to make a feature request:

    To show an option like Login with Touch ID or Login with Face ID based on the user device, I am doing it like this:

    let userDevice = Device()
    if userDevice == .iPhoneX
          || userDevice == .iPhoneXs
          || userDevice == .iPhoneXr
          || userDevice == .iPhoneXsMax
          || userDevice == .simulator(.iPhoneX)
          || userDevice == .simulator(.iPhoneXs)
          || userDevice == .simulator(.iPhoneXr)
          || userDevice == .simulator(.iPhoneXsMax) {
    
    } else {
    
    }
    

    Instead of doing this if we can do like this?:

    let userDevice = Device()
    if userDevice.canAuthenticateWithTouchID() { ... }
    if userDevice.canAuthenticateWithFaceID() { ... }
    
    opened by hemangshah 10
  • Carthage won't build DeviceKit.framework

    Carthage won't build DeviceKit.framework

    Running carthage update --platform iOS results in the following error:

    *** Building scheme "DeviceKit" in DeviceKit.xcodeproj Failed to write to /Users/ryan/Developer/storefront-ios/Carthage/Build/iOS/DeviceKit.framework: Error Domain=NSCocoaErrorDomain Code=260 "The file “DeviceKit.framework” couldn’t be opened because there is no such file." UserInfo={NSURL=file:///Users/ryan/Library/Caches/org.carthage.CarthageKit/DerivedData/9.0_9A235/DeviceKit/1.3.0/Build/Products/Release-iphoneos/DeviceKit.framework, NSFilePath=/Users/ryan/Library/Caches/org.carthage.CarthageKit/DerivedData/9.0_9A235/DeviceKit/1.3.0/Build/Products/Release-iphoneos/DeviceKit.framework, NSUnderlyingError=0x7fdbf3c1cb40 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

    Versions: macOS Sierra 10.12.6 Xcode 9.0 (9A235) Carthage 0.25.0 DeviceKit 1.3.0 and 1.3.1

    opened by rzulkoski 10
  • Install from Pod and new Realease

    Install from Pod and new Realease

    When I install the master branch from pods, it is not working: pod 'DeviceKit', :git => 'https://github.com/dennisweissmann/DeviceKit', :branch => 'master'

    Is it possible, that you make a new release asap?

    opened by Urkman 9
  • CocoaPods instruction for Swift 3.0 in README doesn't work

    CocoaPods instruction for Swift 3.0 in README doesn't work

    The CocoaPods instruction

    pod 'DeviceKit', '~> 1.0'
    

    doesn't work.

    This is due to a bug in CocoaPods ... I currently cannot submit any new versions to the CocoaPods trunk because it doesn't lint. The error I get is:

    === CLEAN TARGET DeviceKit OF PROJECT Pods WITH CONFIGURATION Release ===

    Check dependencies “Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for >targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

    ** CLEAN FAILED **

    The following build commands failed: Check dependencies (1 failure) === BUILD TARGET DeviceKit OF PROJECT Pods WITH CONFIGURATION Release ===

    Check dependencies “Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

    ** BUILD FAILED **

    The following build commands failed: Check dependencies (1 failure) -> DeviceKit (1.0.0) - ERROR | xcodebuild: Returned an unsuccessful exit code.

    Analyzed 1 podspec.

    [!] The spec did not pass validation, due to 1 error.

    /Users/dennis/.rvm/gems/ruby-2.3.1/gems/cocoapods-1.1.0.rc.1/lib/cocoapods/command/spec/lint.rb:77:in run' /Users/dennis/.rvm/gems/ruby-2.3.1@global/gems/claide-1.0.0/lib/claide/command.rb:334:inrun' /Users/dennis/.rvm/gems/ruby-2.3.1/gems/cocoapods-1.1.0.rc.1/lib/cocoapods/command.rb:50:in run' /Users/dennis/.rvm/gems/ruby-2.3.1/gems/cocoapods-1.1.0.rc.1/bin/pod:55:in<top (required)>' /Users/dennis/.rvm/gems/ruby-2.3.1/bin/pod:23:in load' /Users/dennis/.rvm/gems/ruby-2.3.1/bin/pod:23:in

    ' /Users/dennis/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in eval' /Users/dennis/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in
    '

    SWIFT_VERSION is set to 3.0.

    If anyone has any insights on this and knows how to work around please let me know! Thanks! 🙏

    opened by dennisweissmann 9
  • Carthage cache issue (testing with 1.8)

    Carthage cache issue (testing with 1.8)

    Do not know if it is an Xcode 10 or carthage issue or DeviceKit scheme When I build, cache is never used.

    So just wondering if it is an issue with DeviceKit 1.8 because I have a lot of frameworks without any issue

    xcodebuild output can be found in /Users/emarchand/perforce/ericm/depot/4eDimension/main/QMobile/QMobileDataSync/build/log
    *** Valid cache found for Alamofire, skipping build
    *** Invalid cache found for DeviceKit, rebuilding with all downstream dependencies
    *** Valid cache found for FileKit, skipping build
    *** Valid cache found for Prephirences, skipping build
    *** Valid cache found for Result, skipping build
    *** Valid cache found for BrightFutures, skipping build
    *** Valid cache found for Moya, skipping build
    *** Valid cache found for SwiftyJSON, skipping build
    *** Valid cache found for XCGLogger, skipping build
    

    Maybe because the code is generated and there is some hash checking, different with xcode 10

    I check an old build in my Continous integration

    Step 7/17] *** Valid cache found for DeviceKit, skipping build
    

    $ carthage version
    0.30.1
    
    $ cat Cartfile
    github "dennisweissmann/DeviceKit"
    
    $ carthage update --platform iOS --cache-builds
    *** Fetching DeviceKit
    *** Checking out DeviceKit at "1.8.0"
    *** xcodebuild output can be found in /var/folders/4s/whlygvvx3sqfq77vq3slrp7r0000gq/T/carthage-xcodebuild.A8lFMr.log
    *** Invalid cache found for DeviceKit, rebuilding with all downstream dependencies
    *** Building scheme "DeviceKit" in DeviceKit.xcworkspace
    $
    $ carthage update --platform iOS --cache-builds
    *** Fetching DeviceKit
    *** Checking out DeviceKit at "1.8.0"
    *** xcodebuild output can be found in /var/folders/4s/whlygvvx3sqfq77vq3slrp7r0000gq/T/carthage-xcodebuild.HHcaUx.log
    *** Invalid cache found for DeviceKit, rebuilding with all downstream dependencies
    

    I remove my carthage cache and derived data.


    The build work fine anyway

    $ cat /var/folders/4s/whlygvvx3sqfq77vq3slrp7r0000gq/T/carthage-xcodebuild.HHcaUx.log | xcpretty
    ▸ Processing Info.plist
    ▸ Running script 'Generate Device'
    ▸ Compiling DeviceKit_vers.c
    ▸ Compiling DeviceKit_vers.c
    ▸ Compiling Device.generated.swift
    ▸ Compiling Device.generated.swift
    ▸ Analyzing DeviceKit_vers.c
    ▸ Linking DeviceKit
    ▸ Linking DeviceKit
    ▸ Generating 'DeviceKit.framework.dSYM'
    ▸ Touching DeviceKit.framework (in target: DeviceKit)
    ▸ Archive Succeeded
    ▸ Processing Info.plist
    ▸ Running script 'Generate Device'
    ▸ Compiling Device.generated.swift
    ▸ Compiling Device.generated.swift
    ▸ Touching DeviceKit.framework (in target: DeviceKit)
    ▸ Generating 'DeviceKit.framework.dSYM'
    ▸ Build Succeeded
    
    opened by phimage 8
  • Broken

    Broken

    I have a project I use this library in. My SPM says version 4.6.1, everything is working fine. However, I am working on a new project was used SPM to add the dependency and the version says 4.2.0 yet you README says version 5.0.0 is the latest release. I think something is broken with the SPM.

    In my older project where the package version reads 4.6.1. When I click on the dependency it reads the following

    Current version 4.6.1.

    See our detailed changelog for the latest features, improvements and bug fixes.

    In my new project where the package version reads version 4.2.0 after adding the package

    Current version 4.1.0

    See our detailed changelog for the latest features, improvements and bug fixes.

    opened by tazmancoder 2
  • .hasDynamicIsland would be a nice convenience method

    .hasDynamicIsland would be a nice convenience method

    It would be nice to have a convenience method .hasDynamicIsland as more and more devices may add this and it would not be fun to maintain this list for layout specific inclusions/exclusions

    opened by coveloper 0
  • Failed SwiftUI preview on macOS

    Failed SwiftUI preview on macOS

    Hi!

    I'm hitting an issue that the macOS target fails for SwiftUI previews. I understand this package doesn't support macOS, but it does create issues on macOS.

    My situation is: I have a Swift package that supports both iOS and macOS platforms.

    The package uses

    .package(url: "https://github.com/devicekit/DeviceKit", from: "5.0.0"),
    

    in dependencies.

    I set the target dependency for iOS platform only:

    .product(name: "DeviceKit", package: "DeviceKit", condition: .when(platforms: [.iOS])),
    

    Using the DeviceKit package on macOS target has no issues for normal build.

    However, when using SwiftUI preview on macOS target, it always fails. The problem is somehow the SwiftUI preview builds the DeviceKit source code for macOS platform:

    CleanShot 2022-11-24 at 21 12 51@2x

    I think the fix is straightforward, we should wrap the whole generated code under:

    #if os(iOS) || os(watchOS) || os(tvOS)
    
    #endif
    

    This problem happens on the latest Xcode (14.1 (14B47b))

    opened by honghaoz 1
Releases(5.0.0)
  • 5.0.0(Nov 1, 2022)

    Releasedate: 2022-11-01

    pod 'DeviceKit', '~> 5.0'
    

    Breaking changes

    • DeviceKit v5.0.0 drops support for the platforms that Xcode 14 also no longer supports: (#337)

    | Platform | Previous | Now | |----------|----------|------| | iOS | 9.0 | 11.0 | | tvOS | 9.0 | 11.0 | | watchOS | 2.0 | 4.0 |

    New features

    • Retrieve a device's CPU info using eg. Device.current.cpu. (#330)
    • Add .isSimulator to tvOS and watchOS. (#245)
    • Add .isCanvas which indicates whether the app is running in a SwiftUI preview. (#303)

    Contributors

    Thanks to all the contributers of this release!

    Source code(tar.gz)
    Source code(zip)
  • 4.9.0(Nov 1, 2022)

    Releasedate: 2022-11-01

    pod 'DeviceKit', '~> 4.9'
    

    Apple TV 4K (3rd generation) support.

    This version adds support for the new Apple TV (3rd generation) that is released on the 4th of November 2022. (#335)

    | Device | Case value | | --- | --- | | Apple TV 4K (3rd generation) | Device.appleTV4K3 |

    New features

    • Add ability to get current device's thermal state. (#332)

    Bugfixes

    • Fix Apple Watch Series 7 device identifier being incorrect. (#329)

    Contributors

    Thanks to all the contributers of this release!

    Source code(tar.gz)
    Source code(zip)
  • 4.8.0(Oct 28, 2022)

    Version 4.8.0

    Releasedate: 2022-10-28

    pod 'DeviceKit', '~> 4.8'
    

    New October 2022 devices

    This version adds support for the devices that were released in October 2022: (#334)

    | Device | Case value | | --- | --- | | iPad (10th generation) | Device.iPad10 | | iPad Pro 11-inch (4th generation) | Device.iPadPro11Inch4 | | iPad Pro 12.9-inch (6th generation) | Device.iPadPro12Inch6 |

    Source code(tar.gz)
    Source code(zip)
  • 4.7.0(Sep 19, 2022)

    Version 4.7.0

    Releasedate: 2022-09-13

    pod 'DeviceKit', '~> 4.7'
    

    New September 2022 devices

    This version adds support for the devices announced at the September 2022 Apple Event: (#324)

    | Device | Case value | | --- | --- | | iPhone 14 | Device.iPhone14 | | iPhone 14 Plus | Device.iPhone14Plus | | iPhone 14 Pro | Device.iPhone14Pro | | iPhone 14 Pro Max | Device.iPhone14ProMax | | Apple Watch Series 7 (Missing from DeviceKit, from last year) | Device.appleWatchSeries7_41mm, Device.appleWatchSeries7_45mm | | Apple Watch Series 8 | Device.appleWatchSeries8_41mm, Device.appleWatchSeries8_45mm | | Apple Watch SE (2nd generation) | Device.appleWatchSE2_40mm, Device.appleWatchSE2_44mm | | Apple Watch Ultra | Device.appleWatchUltra |

    Bugfixes

    Fix the Device.systemName property which now returns iPadOS instead of iOS when running on an iPad. (#283)

    Source code(tar.gz)
    Source code(zip)
  • 4.6.1(Jul 15, 2022)

  • 4.6.0(Mar 18, 2022)

    Version 4.6.0

    Releasedate: 2022-03-18

    pod 'DeviceKit', '~> 4.6'
    

    New March 2022 devices

    This version adds support for the devices announced at the March 2022 Apple Event: (#286)

    | Device | Case value | | --- | --- | | iPhone SE (3rd generation) | Device.iPhoneSE3 | | iPad Air (5th generation) | Device.iPadAir5 |

    Thanks @Zandor300!

    Source code(tar.gz)
    Source code(zip)
  • 4.5.2(Oct 24, 2021)

    Version 4.5.2

    Releasedate: 2021-10-24

    pod 'DeviceKit', '~> 4.5'
    

    Fixes

    • Fix iPad mini (6th generation) screen size and aspect ratio again. (#300)
    • Add missing device support URLs and images. (#300)

    Thanks @Zandor300 for the fix, thanks @oTranAnhMinh for raising the issue.

    Source code(tar.gz)
    Source code(zip)
  • 4.5.1(Oct 15, 2021)

    Releasedate: 2021-10-15

    pod 'DeviceKit', '~> 4.5'
    

    Fixes

    • Fix iPad mini (6th generation) screen size and aspect ratio. (#294)

    @Zandor300 thank you for the fix 🎉, thank you @rokgregoric for reporting it!

    Source code(tar.gz)
    Source code(zip)
  • 4.5.0(Sep 16, 2021)

    New September 2021 devices

    This version adds support for the devices announced at the September 2021 Apple Event: (#286)

    | Device | Case value | | --- | --- | | iPhone 13 | Device.iPhone13 | | iPhone 13 mini | Device.iPhone13Mini | | iPhone 13 Pro | Device.iPhone13Pro | | iPhone 13 Pro Max | Device.iPhone13ProMax | | iPad (9th generation) | Device.iPad9 | | iPad mini (6th generation) | Device.iPadMini6 |

    Changes

    • Switched from Travis CI to GitHub Actions.
    Source code(tar.gz)
    Source code(zip)
  • 4.4.0(Apr 29, 2021)

    Releasedate: 2021-04-29

    pod 'DeviceKit', '~> 4.4'
    

    This version adds support for the devices announced at the April 2021 Apple Event: (#279)

    • iPad Pro (11-inch) (3rd generation) Device.iPadPro11Inch3
    • iPad Pro (12.9-inch) (5th generation) Device.iPadPro12Inch5
    • Apple TV 4K (2nd generation) Device.appleTV4K2

    Thanks @Zandor300 🎉

    Source code(tar.gz)
    Source code(zip)
  • 4.3.0(Feb 12, 2021)

    Releasedate: 2021-02-12

    pod 'DeviceKit', '~> 4.3'
    

    This version adds support for the Simulator running on Apple Silicon and fixes documentation:

    • Support for running in Simulator on Apple Silicon. (#273)
    • Fix tech specs link and images for iPhone 12 models and iPad Air (4th generation). (#272)

    Thanks @Zandor300 and @FelixII for your contributions!

    Source code(tar.gz)
    Source code(zip)
  • 4.2.1(Oct 22, 2020)

  • 4.2.0(Oct 21, 2020)

    This release will add support for the October 2020 devices. (#262)

    • iPad Air (4th generation)
    • iPhone 12
    • iPhone 12 mini
    • iPhone 12 Pro
    • iPhone 12 Pro Max

    The technical identifiers are there. Images and support links will be added in a feature release. Thanks @Zandor300 🎉.

    Source code(tar.gz)
    Source code(zip)
  • 4.1.0(Sep 21, 2020)

    This release will add support for the September 2020 devices, which will be released on the 18th of September: (#256)

    • iPad (8th generation)
    • Apple Watch Series 6
    • Apple Watch SE
    Device.iPad8
    
    Device.appleWatchSeries6_40mm
    Device.appleWatchSeries6_44mm
    
    Device.appleWatchSE_40mm
    Device.appleWatchSE_44mm
    

    Support for iPad Air (4th generation) will be added in a later version since it will be a long time before we know its device identifiers.

    Source code(tar.gz)
    Source code(zip)
  • 4.0.0(Sep 4, 2020)

    This is a v4.0.0 release because of the possibly breaking change of no longer supporting iOS 9. This decision was made because of Xcode 12 no longer supporting iOS 8.

    • Dropped support for iOS 8. Lowest supported version is now iOS 9. (#249)
    • Updated project settings for Xcode 12. (#248)
    Source code(tar.gz)
    Source code(zip)
  • 3.2.0(Apr 30, 2020)

  • 3.1.0(Mar 29, 2020)

    Thank you @Zandor300 and everyone who opened issues and provided pull requests! 🥳

    2020 iPad Pro

    • Added support for the new 2020 iPad Pro. (#235)
    Device.iPadPro11Inch2 // iPad Pro (11-inch) (2nd generation)
    Device.iPadPro12inch4 // iPad Pro (12.9-inch) (4th generation)
    

    New features

    • Added new functions for detecting LiDAR support.
      • Device.allDevicesWithALidarSensor and Device.current.hasLidarSensor
    Source code(tar.gz)
    Source code(zip)
  • 3.0.0(Jan 20, 2020)

    Thank you @Zandor300 and everyone who opened issues and provided pull requests! 🥳

    Breaking changes

    • The enum for the Apple TV HD has been renamed from .appleTV4 to .appleTVHD. (#211)
    • .allSimulatorXSeriesDevices has been deprecated and replaced by .allSimulatorDevicesWithSensorHousing. (#212)
    • .allXSeriesDevices has been deprecated and replaced by .allDevicesWithSensorHousing. (#212)

    Camera

    • CameraTypes has been renamed to CameraType. (#212)
    • CameraType.normal has been deprecated and replaced by CameraType.wide. (#212)
    • .allDevicesWithNormalCamera has been deprecated and replaced by .allDevicesWithWideCamera. (#212)
    • .hasNormalCamera has been deprecated and replaced by .hasWideCamera. (#212)

    New features

    • You can now check which devices support wireless charging through the following variables: Device.allDevicesWithWirelessChargingSupport and Device.current.supportsWirelessCharging (#209)
    • New .safeDescription variable that will provide you with a safe version of the .description variable. (#212)
      • Example: "iPhone Xʀ" vs "iPhone XR"

    Bugfixes

    • .allDevicesWith3dTouchSupport contained .iPhoneSE which was incorrect. (#226)
    • Some variables would return incorrect values when running on the simulator. (#227)
    Source code(tar.gz)
    Source code(zip)
  • 2.3.0(Oct 2, 2019)

  • 2.2.0(Sep 24, 2019)

    Thank you to all the contributors and a special thanks to @Zandor300 🎉!

    New devices

    • Added support for the new September 2019 devices:
      • iPhone 11
      • iPhone 11 Pro
      • iPhone 11 Pro Max
      • Apple Watch Series 5

    Support for iPad (7th generation) will be added later.

    New features

    • Device.current.cameras now has the .ultraWide camera type added for devices with that camera.
    Source code(tar.gz)
    Source code(zip)
  • 2.1.0(Sep 1, 2019)

    Thank you for all for your contributions and a special thank you to @Zandor300! 🎉

    New features

    • Add support for the new iPod touch (7th generation) (#189)
    • Added Device.allApplePencilCapableDevices and Device.current.applePencilSupport variables for checking Apple Pencil support. (#179)
      • .applePencilSupport returns ApplePencilSupport.firstGeneration or ApplePencilSupport.secondGeneration for checking which Apple Pencil is supported.
    • Added 3D Touch (iOS) and Force Touch (watchOS) support variables: (#183)
      • iOS
        • Device.allDevicesWith3dTouchSupport
        • Device.current.has3dTouchSupport
      • watchOS
        • Device.allWatchesWithForceTouchSupport
        • Device.current.hasForceTouchSupport
    • Added variable to check for the camera's a device has. (#188)
      • Example: Device.iPhoneXS.cameras should return CameraTypes.normal and CameraTypes.telephoto.

    Fixes

    • Rename iPod touch 5 and 6 to iPod touch (5th generation) and iPod touch (6th generation) respectively. (#189)
    • Rename Apple TV (4th generation) to Apple TV HD to comply with Apple's rename of the device. (#196)
    • Improve support for Swift Package Manager. (#193)
    • Fixed the Device.current.isZoomed variable. (#59 comment and #198)
    Source code(tar.gz)
    Source code(zip)
  • 2.0.0(Apr 10, 2019)

    Version 2.0 release 🎉

    Thank you to all the contributors who made this release happen 💕 and a special thank you to @Zandor300 for all his effort and working closely with me to release this version 😊.

    Breaking changes

    • The original Device() constructor has been made private in favour of using Device.current to match UIDevice.current.
    • The enum values for the iPhone Xs, iPhone Xs Max and iPhone Xʀ have been renamed to be .iPhoneXS, .iPhoneXSMax and .iPhoneXR to match proper formatting.
    • .description for the iPhone Xs, iPhone Xs Max and iPhone Xʀ have been changed to contain small caps formatting for the s and the ʀ part.
    • .description for the iPad 5 and iPad 6 have been changed to the proper names; iPad (5th generation) and iPad (6th generation).
    • .name, .systemName, .systemVersion, .model, .localizedModel, .batteryState and .batteryLevel will now all return nil when you try to get its value when the device you are getting it from isn't the current one. (eg. Device.iPad6.name while running on iPad 5)

    New features

    • Updated to Swift 5!
    • New .allDevicesWithRoundedDisplayCorners and .hasRoundedDisplayCorners values to check if a device has rounded display corners. (eg. iPhone Xs and iPad Pro (3rd generation))
    • new .allDevicesWithSensorHousing and .hasSensorHousing values to check if a device has a screen cutout for the sensor housing. (eg. iPhone Xs)

    Bugfixes

    • .isPad and .isPhone are now giving correct outputs again.
    Source code(tar.gz)
    Source code(zip)
  • 1.11.0(Dec 12, 2018)

  • 1.9.0(Oct 11, 2018)

  • 1.8.0(Sep 17, 2018)

  • 1.7.0(Apr 13, 2018)

  • 1.6.0(Apr 4, 2018)

    This fixes several bugs:

    • Documentation issues
    • isZoomed for iPhone falsely returned true
    • reset UIDevice.current.isBatteryMonitoringEnabled to what is was before so we don't interfere with user code
    • add support for iPad 6
    Source code(tar.gz)
    Source code(zip)
  • 1.5.0(Jan 29, 2018)

Owner
DeviceKit
DeviceKit
NFC Forum Well Known Type Data Parser for iOS11 and Core NFC

NFCNDEFParse NFC Forum Well Known Type Data Parser for iOS11 and Core NFC. Supports parsing of types: Text - NFCForum-TS-RTD_Text_1.0 2006-07-24 Uri -

Jari Kalinainen 14 Oct 21, 2022
DeviceKit is a value-type replacement of UIDevice.

Branch Build Status Versions master ≥ 2.0 Swift 4 - 4.2 ≥ 1.3 < 1.13 Swift 3 ≥ 1.0 < 1.3 Swift 2.3 < 1.0 DeviceKit is a value-type replacement of UIDe

DeviceKit 3.9k Dec 30, 2022
UIDevice extensions that fill in the missing pieces.

UIDeviceComplete is an iOS library intended to be a collection of extensions to UIDevice that provides functionality that UIDevice currently lacks like determining which iOS device you have (i.e iPhone X, iPhone 8, iPhone SE, iPad Pro, iPhone 7 etc) or determining the screen size of the device in inches.

Nicholas Maccharoli 408 Dec 11, 2022
UIDevice extensions that fill in the missing pieces.

UIDeviceComplete UIDevice extensions that fill in the missing pieces. Whats this library about? UIDeviceComplete is an iOS library intended to be a co

Nicholas Maccharoli 408 Dec 11, 2022
Type-safe networking abstraction layer that associates request type with response type.

APIKit APIKit is a type-safe networking abstraction layer that associates request type with response type. // SearchRepositoriesRequest conforms to Re

Yosuke Ishikawa 1.9k Dec 30, 2022
A phantom type is a custom type that has one or more unused type parameters.

PhantomTypes A phantom type is a custom type that has one or more unused type parameters. Phantom types allow you to enforce type-safety without sacri

null 3 Nov 4, 2022
Animate numeric value while setting new value to label

NumericAnimatedLabel Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installati

Javal Nanda 28 Oct 11, 2021
A replacement for as which runs in constant time instead of O(n) when the conformance is not satisfiedA replacement for as which runs in constant time instead of O(n) when the conformance is not satisfied

ZConform A replacement for as? which runs in constant time instead of O(n) when the conformance is not satisfied. How it works ZConform does a one-tim

Emerge Tools 20 Aug 4, 2022
Modern thread-safe and type-safe key-value observing for Swift and Objective-C

Now Archived and Forked PMKVObserver will not be maintained in this repository going forward. Please use, create issues on, and make PRs to the fork o

Postmates Inc. 708 Jun 29, 2022
A protocol-centric, type and queue safe key-value workflow.

Light-weight, strict protocol-first styled PropertyKit helps you to easily and safely handle guaranteed values, keys or types on various situations of

gitmerge 12 Feb 26, 2021
An Integer type that clamps its value to its minimum and maximum instead of over- or underflowing.

ClampedInteger An Integer type that clamps its value to its minimum and maximum instead of over- or underflowing. Examples let big = ClampedIntege

Berik Visschers 0 Jan 17, 2022
Type-safe CAAnimation wrapper. It makes preventing to set wrong type values.

TheAnimation TheAnimation is Type-safe CAAnimation wrapper. Introduction For example, if you want to animate backgroundColor with CABasicAnimation, yo

Taiki Suzuki 222 Dec 6, 2022
Cachyr A typesafe key-value data cache for iOS, macOS, tvOS and watchOS written in Swift.

Cachyr A typesafe key-value data cache for iOS, macOS, tvOS and watchOS written in Swift. There already exists plenty of cache solutions, so why creat

Norsk rikskringkasting (NRK) 124 Nov 24, 2022
💾 Safe, statically-typed, store-agnostic key-value storage written in Swift!

Storez ?? Safe, statically-typed, store-agnostic key-value storage Highlights Fully Customizable: Customize the persistence store, the KeyType class,

Kitz 67 Aug 7, 2022
SwiftStore - Key/Value store for Swift backed by LevelDB.

SwiftStore Key/Value store for Swift backed by LevelDB. Usage Create instances of store import SwiftStore

Hemant Sapkota 119 Dec 21, 2022
:octocat:💧 A slider widget with a popup bubble displaying the precise value selected. Swift UI library made by @Ramotion

FLUID SLIDER A slider widget with a popup bubble displaying the precise value selected written on Swift. We specialize in the designing and coding of

Ramotion 1.9k Dec 23, 2022
UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizontal.

MultiSlider UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizo

Yonat Sharon 326 Dec 29, 2022
A Swift Encoder for encoding any Encodable value into an array of URLQueryItem.

URLQueryItemEncoder A Swift Encoder for encoding any Encodable value into an array of URLQueryItem. As part of the SE-0166, Swift has a foundation for

Pitiphong Phongpattranont 60 Aug 21, 2022
A slider widget with a popup bubble displaying the precise value selected written on Swift.

A slider widget with a popup bubble displaying the precise value selected written on Swift. We specialize in the designing and coding of

Ramotion 1.9k Dec 23, 2022
🎚️ STDiscreteSlider – slider which allows user to choose value only from predefined set of data.

STDiscreteSlider – slider which allows user to choose value only from predefined set of data. Slider may receive any types of options, you may pass set of integers or strings, or any other type. Written using SwiftUI.

Tamerlan Satualdypov 15 Apr 3, 2022