[api-upload-refactor] Set deployment target to iOS 15, simplify upload

- Package.swift: .iOS(.v13) -> .iOS(.v15), .watchOS(.v6) -> .v8
  (README already stated iOS 15; watchOS 8 needed for URLSession.upload(for:fromFile:))
- drop the iOS-13 uploadTask continuation bridge; both upload overloads now
  share one runUpload using session.upload(for:fromFile:delegate:)
- remove now-redundant @available(iOS 15) from the progress overload and test
- Documentation/API.md: drop iOS-version caveats
This commit is contained in:
Daniel Arantes Loverde
2026-08-29 18:51:45 -03:00
parent 20d761b361
commit 6acec0ff3a
5 changed files with 43 additions and 58 deletions

View File

@@ -30,7 +30,7 @@ let user: User = try await API.shared.request(
| Large file upload loads the whole file into a `Data` | `form.file(_:url:)` streams from disk in 64 KB chunks |
| Retry logic copy-pasted, often unbounded | `persistConnection: true`, bounded by `API.maxPersistRetries` |
| Client-certificate (mTLS) needs a custom `URLSessionDelegate` per project | `setupCertification(certData:password:)` |
| Progress reporting needs a delegate + KVO wiring | `upload(..., onProgress:)` (iOS 15+) |
| Progress reporting needs a delegate + KVO wiring | `upload(..., onProgress:)` |
| `@MainActor` hops or manual `DispatchQueue` juggling | `actor`-isolated, `Sendable`-checked, runs off the main thread |
| Response types must be `Codable` even when only decoding | `T: Decodable & Sendable` |
@@ -177,9 +177,9 @@ let result: UploadResult = try await API.shared.upload(
```
The body is serialised to a temp file and always removed afterwards, on success
and on throw. Works on iOS 13+.
and on throw.
### With progress (iOS 15+)
### With progress
```swift
let result: UploadResult = try await API.shared.upload(