Skip to content

Commit c0a0c66

Browse files
committed
[Update] update demo
1 parent bd6fc29 commit c0a0c66

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Demo.playground/Pages/Basic.xcplaygroundpage/Contents.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,17 @@ extension BasicAPI {
3838
/// This is an api for requests using the **POST** method.
3939
///
4040
/// The full api address is: [](https://postman-echo.com/post) .
41-
/// The api is entered as a **tuple** type and requires two parameters of type `String`, where the second parameter can be `nil`.
41+
/// The api is entered as a **tuple** type and requires two parameters, where the second parameter can be `nil`.
4242
@POST("/post")
43-
static var postWithTuple: APIParameterBuilder<(foo1: String, foo2: String?)>? = {
43+
static var postWithTuple: APIParameterBuilder<(foo1: String, foo2: Int?)>? = {
4444
[
4545
"foo1": $0.foo1,
4646
"foo2": $0.foo2,
4747
]
48+
49+
// Eliminate the warning by explicitly converting to `[String: Any?]`.
50+
// Also ensure that `nil` parameters can be filtered.
51+
as [String: Any?]
4852
}
4953

5054
/// This is an api for requests using the **POST** method.
@@ -53,6 +57,8 @@ extension BasicAPI {
5357
/// This api is referenced with the `Arg` type.
5458
@POST("/post")
5559
static var postWithModel: APIParameterBuilder<Arg>? = {
60+
// You can have your model follow the `APIParameterConvertible` protocol.
61+
// or use `AnyAPIHashableParameter` to wrap your model in an outer layer.
5662
AnyAPIHashableParameter($0)
5763
}
5864
}

0 commit comments

Comments
 (0)