Skip to content

Commit

Permalink
Add Swift 6 Release Notes
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Oct 21, 2024
1 parent 10a8bc3 commit 4dd545e
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 3 deletions.
37 changes: 34 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ After adding the dependency both [ServiceStack.Swift](https://github.com/Service
```swift
dependencies: [
.package(name: "ServiceStack", url: "https://github.com/ServiceStack/ServiceStack.Swift.git",
Version(5,0,0)..<Version(6,0,0)),
Version(6,0,0)..<Version(7,0,0)),
],
```

Expand All @@ -56,13 +56,44 @@ In your [Podfile](https://guides.cocoapods.org/syntax/podfile.html):
use_frameworks!

# Pods for Project
pod "ServiceStack", '~> 5.0'
pod "ServiceStack", '~> 6.0'
```

#### Carthage

```ruby
github "ServiceStack/ServiceStack.Swift" ~> 5.0
github "ServiceStack/ServiceStack.Swift" ~> 6.0
```

### v6.0.0 Release

The latest **v6** Release is now dependency-free, where its PromiseKit async APIs have been replaced to use
[Swift's native Concurrency](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/concurrency/) support.

```swift
import ServiceStack

let client = JsonServiceClient(baseUrl:baseUrl)
```

#### Async

```swift
let request = Hello()
request.name = "World"

let response = try await client.postAsync(request)
print(response.result!)
```

#### Sync

```swift
let request = Hello()
request.name = "World"

let response = try client.post(request)
print(response.result!)
```

### v5.0.0 Release
Expand Down
16 changes: 16 additions & 0 deletions Tests/ServiceStackTests/JsonServiceClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ final class JsonServiceClientTests : @unchecked Sendable {
client = JsonServiceClient(baseUrl: "https://test.servicestack.net")
}

@Test func Can_GET_Hello() throws {
let request = Hello()
request.name = "World"

let response = try client.post(request)
print(response.result!)
}

@Test func Can_GET_Hello_async() async throws {
let request = Hello()
request.name = "World"

let response = try await client.postAsync(request)
print(response.result!)
}

@Test func Can_POST_Test_HelloAllTypes_async() async throws {
let request = createHelloAllTypes()

Expand Down

0 comments on commit 4dd545e

Please sign in to comment.