Skip to content

Commit c3f21b5

Browse files
committed
Update README.md.
1 parent 5703f18 commit c3f21b5

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ do {
2222
}
2323
```
2424

25-
iOS 16 or later is required.
25+
iOS 18 or later is required.
2626

2727
# WebServiceProxy
2828
The `WebServiceProxy` class is used to issue API requests to the server. This class provides a single initializer that accepts the following arguments:

Tests/EchoTests/EchoTests.swift

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,23 @@ final class EchoTests: XCTestCase {
3636
let flag: Bool
3737
}
3838

39-
func createWebServiceProxy() -> WebServiceProxy {
40-
let sessionConfiguration = URLSessionConfiguration.default
39+
func testExample() async throws {
40+
let baseURL = URL(string: "http://localhost:8080/kilo-test/")!
4141

42-
sessionConfiguration.requestCachePolicy = .reloadIgnoringLocalAndRemoteCacheData
43-
sessionConfiguration.timeoutIntervalForResource = 4
42+
let webServiceProxy = WebServiceProxy(session: URLSession.shared, baseURL: baseURL)
4443

45-
let session = URLSession(configuration: sessionConfiguration)
44+
do {
45+
// GET test/fibonacci?count=8
46+
let response: [Int] = try await webServiceProxy.invoke(.get, path: "test/fibonacci", arguments: [
47+
"count": 8
48+
])
4649

47-
return WebServiceProxy(session: session, baseURL: URL(string: "http://localhost:8080/kilo-test/")!)
50+
print(response) // [0, 1, 1, 2, 3, 5, 8, 13]
51+
} catch {
52+
print(error.localizedDescription)
53+
}
4854
}
49-
55+
5056
func testGet() async throws {
5157
let webServiceProxy = createWebServiceProxy()
5258

@@ -72,16 +78,6 @@ final class EchoTests: XCTestCase {
7278
XCTAssert(result.date == now)
7379
XCTAssert(result.dates == [now])
7480
}
75-
76-
func testGetFibonacci() async throws {
77-
let webServiceProxy = createWebServiceProxy()
78-
79-
let result: [Int] = try await webServiceProxy.invoke(.get, path: "test/fibonacci", arguments: [
80-
"count": 8
81-
])
82-
83-
XCTAssert(result == [0, 1, 1, 2, 3, 5, 8, 13])
84-
}
8581

8682
func testPost() async throws {
8783
let webServiceProxy = createWebServiceProxy()
@@ -217,4 +213,15 @@ final class EchoTests: XCTestCase {
217213
XCTAssert(true)
218214
}
219215
}
216+
217+
func createWebServiceProxy() -> WebServiceProxy {
218+
let sessionConfiguration = URLSessionConfiguration.default
219+
220+
sessionConfiguration.requestCachePolicy = .reloadIgnoringLocalAndRemoteCacheData
221+
sessionConfiguration.timeoutIntervalForResource = 4
222+
223+
let session = URLSession(configuration: sessionConfiguration)
224+
225+
return WebServiceProxy(session: session, baseURL: URL(string: "http://localhost:8080/kilo-test/")!)
226+
}
220227
}

0 commit comments

Comments
 (0)