Several fixes and optimizations all over the library #28

Merged
javier merged 22 commits from library/several-fixes-and-optimizations into main 2026-07-26 09:56:33 +00:00
Showing only changes of commit fb95989d83 - Show all commits
+12 -2
View File
@@ -31,7 +31,7 @@ let package = Package(
It is also possible to use this library with your app in Xcode by adding it as a dependency in your Xcode project. It is also possible to use this library with your app in Xcode by adding it as a dependency in your Xcode project.
> [!IMPORTANT] > [!IMPORTANT]
> Swift 5.10 or higher is required in order to build this library. > Swift 6.2 or higher is required in order to build this library.
## Usage ## Usage
@@ -83,7 +83,7 @@ let service = AmiiboService(
## Testing ## Testing
The `AmiiboClient` protocol enables creating custom mock clients for unit testing without network calls. Conform to `AmiiboClient` and inject it into `AmiiboService` via its `init(client:)` initializer: The `AmiiboClient` protocol enables creating custom mock clients for unit testing without network calls. Conform to `AmiiboClient` and inject it into `AmiiboService` via its `init(client:)` initializer. Since `AmiiboClient` refines `Sendable`, conforming types must be safe to share across concurrency domains:
```swift ```swift
import AmiiboService import AmiiboService
@@ -104,6 +104,16 @@ struct MyMockClient: AmiiboClient {
let service = AmiiboService(client: MyMockClient()) let service = AmiiboService(client: MyMockClient())
``` ```
### Running the test suite
The unit tests based on a mock client run offline by default. The tests against the live service are skipped unless the `AMIIBO_LIVE_TESTS` environment variable is set to `1`, either in the environment when testing from the command line:
```shell
AMIIBO_LIVE_TESTS=1 swift test
```
or in the `Test` action of the scheme when testing from Xcode.
## Documentation ## Documentation
Please refer to the [online documentation](https://rock-n-code.github.io/amiibo-service/documentation/amiiboservice/) for further information about this library. Please refer to the [online documentation](https://rock-n-code.github.io/amiibo-service/documentation/amiiboservice/) for further information about this library.