|
8 | 8 |
|
9 | 9 |
|
10 | 10 | ## Introduction
|
11 |
| -UIDevice extension to fetch current device info such commercial name (iPhone X instead of iPhone10,3). |
| 11 | +Use `DeviceModel` to get some usefull information about some Apple devices (specially iPhones and iPads). |
| 12 | + |
| 13 | +> Currently the Mac models available in this library correspond only to those that use Apple Silicon chips |
12 | 14 |
|
13 | 15 | ## Platforms
|
14 |
| -Support for iOS and tvOS |
| 16 | +Support for iOS, iPadOS, macOS and tvOS |
15 | 17 |
|
16 | 18 | ## Support
|
17 | 19 | For Swift 4 please use v1
|
18 | 20 |
|
19 | 21 | For Swift 5 please use v2+
|
20 | 22 |
|
21 | 23 | ## Installation
|
22 |
| -This framework is compatible with Carthage or Cocoapods, use one of both. |
23 |
| -### Carthage |
24 |
| -Add this into your `Cartfile`: |
25 |
| -```ogdl |
26 |
| -github "sebastianvarela/DeviceIdentificator" |
| 24 | +### Swift Package Manager |
| 25 | +Add the package using Xcode or copy this into your `Package.swift` file: |
| 26 | +```swift |
| 27 | +.package(url: "https://github.com/sebastianvarela/DeviceIdentificator", from: "3.0.5") |
27 | 28 | ```
|
28 |
| -### Cocoapods |
29 |
| -Add this into your `Podfile`: |
30 |
| -```ogdl |
31 |
| -pod 'DeviceIdentificator' |
| 29 | + |
| 30 | +### Manually |
| 31 | +To install it manually, drag the DeviceIdentificator folder into your app project in Xcode. You can also add it as a git submodule by running the following command: |
| 32 | +```zsh |
| 33 | +$ git submodule add https://github.com/sebastianvarela/DeviceIdentificator.git |
32 | 34 | ```
|
33 | 35 |
|
34 | 36 | ## Usage
|
35 |
| -Swift: |
36 | 37 | ```swift
|
37 |
| -let deviceModel = UIDevice.current.deviceModel |
38 |
| -print("Current device: \(deviceModel.name)") |
| 38 | +import DeviceIdentificator |
39 | 39 |
|
40 |
| -let isIpad = UIDevice.current.isIpad |
41 |
| -let isSimulator = UIDevice.current.isSimulator |
42 |
| -``` |
| 40 | +let deviceModel = DeviceModel.current |
| 41 | +print("Current device: \(deviceModel.name)") |
43 | 42 |
|
44 |
| -Objective-C: |
45 |
| -```objectivec |
46 |
| -NSString *deviceModelName = [UIDevice currentDevice].deviceModelName; |
47 |
| -NSLog(@"Current device: %@", [UIDevice currentDevice].deviceModelName); |
48 |
| - |
49 |
| -BOOL isIpad = [UIDevice currentDevice].isIpad; |
50 |
| -BOOL isSimulator = [UIDevice currentDevice].isSimulator; |
| 43 | +let isIpad = deviceModel.isIpad |
| 44 | +let isSimulator = deviceModel.isSimulator |
51 | 45 | ```
|
0 commit comments