Skip to content

Commit 5b270d7

Browse files
authored
Linux support (#116)
* Linux build * Remove "result of call to 'registerClass' is unused" warning
1 parent b6fe7dc commit 5b270d7

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

Sources/Mock.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
import Foundation
1212
import XCTest
13+
#if canImport(FoundationNetworking)
14+
import FoundationNetworking
15+
#endif
1316

1417
/// A Mock which can be used for mocking data requests with the `Mocker` by calling `Mocker.register(...)`.
1518
public struct Mock: Equatable {

Sources/Mocker.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
//
88

99
import Foundation
10+
#if canImport(FoundationNetworking)
11+
import FoundationNetworking
12+
#endif
1013

1114
/// Can be used for registering Mocked data, returned by the `MockingURLProtocol`.
1215
public struct Mocker {
@@ -73,7 +76,7 @@ public struct Mocker {
7376

7477
private init() {
7578
// Whenever someone is requesting the Mocker, we want the URL protocol to be activated.
76-
URLProtocol.registerClass(MockingURLProtocol.self)
79+
_ = URLProtocol.registerClass(MockingURLProtocol.self)
7780
}
7881

7982
/// Register new Mocked data. If a mock for the same URL and HTTPMethod exists, it will be overwritten.

Sources/MockingURLProtocol.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
//
88

99
import Foundation
10+
#if canImport(FoundationNetworking)
11+
import FoundationNetworking
12+
#endif
1013

1114
/// The protocol which can be used to send Mocked data back. Use the `Mocker` to register `Mock` data
1215
open class MockingURLProtocol: URLProtocol {

0 commit comments

Comments
 (0)