Skip to content

Commit cd1c75b

Browse files
committed
Support for Swift Package Manager
1 parent 87ef0ed commit cd1c75b

File tree

6 files changed

+73
-5
lines changed

6 files changed

+73
-5
lines changed

.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: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
1+
// swift-tools-version:5.2
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
14
import PackageDescription
25

36
let package = Package(
4-
name: "SwiftyTimer",
5-
dependencies: [],
6-
exclude: ["Sources/Info.plist", "Sources/SwiftyTimer.h", "SwiftyTimerTests"]
7-
8-
)
7+
name: "SwiftyTimer",
8+
products: [
9+
// Products define the executables and libraries produced by a package, and make them visible to other packages.
10+
.library(
11+
name: "SwiftyTimer",
12+
targets: ["SwiftyTimer"]),
13+
],
14+
dependencies: [
15+
// Dependencies declare other packages that this package depends on.
16+
// .package(url: /* package url */, from: "1.0.0"),
17+
],
18+
targets: [
19+
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
20+
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
21+
.target(
22+
name: "SwiftyTimer",
23+
dependencies: [],
24+
path: "Sources",
25+
exclude: ["Info.plist", "SwiftyTimer.h"]
26+
),
27+
.testTarget(
28+
name: "SwiftyTimerTests",
29+
dependencies: ["SwiftyTimer"]),
30+
]
31+
)

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ Just add to your Cartfile:
108108
github "radex/SwiftyTimer"
109109
```
110110

111+
#### Swift Package Manager
112+
- iOS: Open Xcode, File->Swift Packages, search input **https://github.com/radex/SwiftyTimer.git**, and then select Version Up to Next Major **2.1.1** < .
113+
- Or add dependencies in your `Package.swift`:
114+
```ruby
115+
.package(url: "https://github.com/radex/SwiftyTimer.git", .upToNextMajor(from: "2.1.1")),
116+
```
117+
111118
#### Manually
112119

113120
Simply copy `Sources/SwiftyTimer.swift` to your Xcode project.

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 SwiftyTimerTests
4+
5+
var tests = [XCTestCaseEntry]()
6+
tests += SwiftyTimerTests.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 SwiftyTimer
3+
4+
final class SwiftyTimerTests: 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(SwiftyTimer().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(SwiftyTimerTests.allTests),
7+
]
8+
}
9+
#endif

0 commit comments

Comments
 (0)