Skip to content

Commit 5ed0c37

Browse files
Update to use Swift Package Manager
1 parent c8d06ce commit 5ed0c37

12 files changed

Lines changed: 63 additions & 439 deletions

File tree

.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// swift-tools-version:5.0
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "UIDeviceModel",
7+
platforms: [
8+
.iOS(.v8),
9+
.watchOS(.v2),
10+
.tvOS(.v9),
11+
],
12+
products: [
13+
.library(name: "UIDeviceModel", targets: [
14+
"UIDeviceModel",
15+
]),
16+
],
17+
targets: [
18+
.target(name: "UIDeviceModel"),
19+
]
20+
)

README.md

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,22 @@
11
# UIDeviceModel
22

3-
[![Language](https://img.shields.io/badge/swift-4.2-orange.svg)](https://swift.org/)
4-
[![License](https://img.shields.io/github/license/theoriginalbit/UIDeviceModel.svg)](LICENSE)
5-
[![Pod Version](https://img.shields.io/cocoapods/v/UIDeviceModel.svg)](https://cocoapods.org/pods/UIDeviceModel)
6-
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Carthage/Carthage)
7-
83
A µframework to detect the device model provided through an extension of `UIDevice`. It also allows detection of the simulator and the device model it is simulating.
94

105
## Installation
116

12-
### CocoaPods
13-
14-
```ruby
15-
pod 'UIDeviceModel', '~> 1.0'
16-
```
17-
18-
### Carthage
7+
### Swift Package Manager
198

20-
```ogdl
21-
github "theoriginalbit/UIDeviceModel"
9+
```swift
10+
.package(url: "https://github.com/theoriginalbit/UIDeviceModel.git", .upToNextMajor(from: "3.0.0"))
2211
```
2312

2413
## Usage
2514

26-
First import the framework:
15+
Common usage would be to use in a switch statement
2716

2817
```swift
2918
import UIDeviceModel
30-
```
31-
32-
Common usage would be to use in a switch statement
3319

34-
```swift
3520
let deviceModel = UIDevice.current.deviceModel
3621

3722
switch deviceModel {
@@ -53,4 +38,4 @@ switch deviceModel {
5338
case .simulator(let simulatedDeviceModel): break // It's as if it never happened
5439
default: break
5540
}
56-
```
41+
```

Source/Info.plist

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

Source/UIDeviceModel.h

Lines changed: 0 additions & 19 deletions
This file was deleted.
File renamed without changes.

Tests/LinuxMain.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import XCTest
2+
3+
import UIDeviceModelTests
4+
5+
var tests = [XCTestCaseEntry]()
6+
tests += UIDeviceModelTests.allTests()
7+
XCTMain(tests)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import XCTest
2+
@testable import UIDeviceModel
3+
4+
final class UIDeviceModelTests: XCTestCase {
5+
func testExample() {
6+
// This is an example of a functional test case.
7+
// Use XCTAssert and related functions to verify your tests produce the correct
8+
// results.
9+
XCTAssertEqual(UIDeviceModel().text, "Hello, World!")
10+
}
11+
12+
static var allTests = [
13+
("testExample", testExample),
14+
]
15+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import XCTest
2+
3+
#if !canImport(ObjectiveC)
4+
public func allTests() -> [XCTestCaseEntry] {
5+
return [
6+
testCase(UIDeviceModelTests.allTests),
7+
]
8+
}
9+
#endif

0 commit comments

Comments
 (0)