Skip to content

Commit e9e97a0

Browse files
committed
d Add Swift Package Manager to Examples
1 parent 04e947e commit e9e97a0

File tree

6 files changed

+62
-1
lines changed

6 files changed

+62
-1
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ project.xcworkspace/
99
xcuserdata/
1010
compile_commands.json
1111
.swiftpm
12-
.build
12+
.build
13+
Examples/MacExample-SwiftPackageManager/Package.resolved
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// swift-tools-version:5.3
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: "Example",
8+
products: [
9+
.library(
10+
name: "Example",
11+
targets: ["Example"]),
12+
],
13+
dependencies: [
14+
.package(
15+
name: "OCHamcrest",
16+
url: "https://github.com/hamcrest/OCHamcrest",
17+
.branch("main")
18+
),
19+
],
20+
targets: [
21+
.target(
22+
name: "Example",
23+
dependencies: [],
24+
publicHeadersPath: "./"
25+
),
26+
.testTarget(
27+
name: "ExampleTests",
28+
dependencies: [
29+
"Example",
30+
"OCHamcrest",
31+
]
32+
),
33+
]
34+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`swift test` to run unit tests. Try changing the test to fail.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@import Foundation;
2+
3+
@interface Example : NSObject
4+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#import "Example.h"
2+
3+
@implementation Example
4+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@import OCHamcrest;
2+
@import XCTest;
3+
4+
5+
@interface ExampleTests : XCTestCase
6+
@end
7+
8+
@implementation ExampleTests
9+
10+
- (void)testUsingAssertThat
11+
{
12+
assertThat(@"xx", is(@"xx"));
13+
assertThat(@"yy", isNot(@"xx"));
14+
assertThat(@"i like cheese", containsSubstring(@"cheese"));
15+
}
16+
17+
@end

0 commit comments

Comments
 (0)