Skip to content

Commit 152dc69

Browse files
Merge pull request #6 from hyperdevs-team/spm
Add Swift Package Manager support
2 parents 14d2fa0 + 4bd62c7 commit 152dc69

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1500
-1860
lines changed

DeviceIdentificator.podspec

Lines changed: 0 additions & 23 deletions
This file was deleted.

DeviceIdentificator.xcodeproj/project.pbxproj

Lines changed: 0 additions & 704 deletions
This file was deleted.

DeviceIdentificator.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 0 additions & 7 deletions
This file was deleted.

DeviceIdentificator.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

Lines changed: 0 additions & 8 deletions
This file was deleted.

DeviceIdentificator.xcodeproj/xcshareddata/xcschemes/DeviceIdentificator-iOS.xcscheme

Lines changed: 0 additions & 96 deletions
This file was deleted.

DeviceIdentificator.xcodeproj/xcshareddata/xcschemes/DeviceIdentificator-tvOS.xcscheme

Lines changed: 0 additions & 96 deletions
This file was deleted.

Package.swift

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// swift-tools-version: 5.9
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "DeviceIdentificator",
8+
platforms: [
9+
.watchOS(.v6),
10+
.tvOS(.v14),
11+
.visionOS(.v1),
12+
.iOS(.v14),
13+
.macCatalyst(.v14),
14+
.macOS(.v13)
15+
],
16+
products: [
17+
// Products define the executables and libraries a package produces, making them visible to other packages.
18+
.library(
19+
name: "DeviceIdentificator",
20+
targets: ["DeviceIdentificator"]),
21+
],
22+
targets: [
23+
// Targets are the basic building blocks of a package, defining a module or a test suite.
24+
// Targets can depend on other targets in this package and products from dependencies.
25+
.target(
26+
name: "DeviceIdentificator"),
27+
.testTarget(
28+
name: "DeviceIdentificatorTests",
29+
dependencies: ["DeviceIdentificator"]),
30+
]
31+
)
32+
33+
let swiftSettings: [SwiftSetting] = [
34+
.enableUpcomingFeature("BareSlashRegexLiterals"),
35+
]
36+
37+
for target in package.targets {
38+
target.swiftSettings = target.swiftSettings ?? []
39+
target.swiftSettings?.append(contentsOf: swiftSettings)
40+
}

README.md

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,39 @@
88

99

1010
## 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
1214
1315
## Platforms
14-
Support for iOS and tvOS
16+
Support for iOS, iPadOS, macOS and tvOS
1517

1618
## Support
1719
For Swift 4 please use v1
1820

1921
For Swift 5 please use v2+
2022

2123
## 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+
25+
### Swift Package Manager
26+
Add the package using Xcode or copy this into your `Package.swift` file:
27+
```swift
28+
.package(url: "https://github.com/sebastianvarela/DeviceIdentificator", from: "4.0.0")
2729
```
28-
### Cocoapods
29-
Add this into your `Podfile`:
30-
```ogdl
31-
pod 'DeviceIdentificator'
30+
31+
### Manually
32+
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:
33+
```zsh
34+
$ git submodule add https://github.com/sebastianvarela/DeviceIdentificator.git
3235
```
3336

3437
## Usage
35-
Swift:
3638
```swift
37-
let deviceModel = UIDevice.current.deviceModel
38-
print("Current device: \(deviceModel.name)")
39+
import DeviceIdentificator
3940

40-
let isIpad = UIDevice.current.isIpad
41-
let isSimulator = UIDevice.current.isSimulator
42-
```
41+
let deviceModel = DeviceModel.current
42+
print("Current device: \(deviceModel.name)")
4343

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;
44+
let isIpad = deviceModel.isIpad
45+
let isSimulator = deviceModel.isSimulator
5146
```

Source/DeviceIdentificator.h

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)