Comments (2)
@wmorgue not entirely sure what you mean, but here is a pseudo example.
import SwiftUI
import Get
let client = APIClient(host: "api.example.com")
struct User: Decodable {
let id: String
}
struct ContentView: View {
@State private var userId: String?
var body: some View {
if let userId = userId {
Text(userId)
} else {
ProgressView()
.task {
do {
let user: User = try await client.send(.get("/user/testing")).value
self.userId = user.id
} catch {
print(error.localizedDescription)
}
}
}
}
}
from get.
@ericlewis oh gosh, it works for me.
Thank you 🤝
from get.
Related Issues (20)
- Protocol for APIClient Methods HOT 1
- CocoaPods support HOT 1
- Concurrency warning HOT 2
- can't get this to build to xcframeworks
- AnyEncodable
- send(_:) method always tries to decode empty response since newest version HOT 6
- Crashes with Swift 5.7 and Xcode14 HOT 6
- Add `MultiAPIClientDelegate`, a delegate that forwards calls to multiple underlying delegates. HOT 2
- How to handle 422 json error response? HOT 4
- Post processing of raw response in delegate, like client(,willSendRequest:) HOT 4
- Conforming to `Codable` HOT 2
- Problem with sending post requests HOT 1
- Add urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:) to DataLoader's implemented delegate callbacks HOT 1
- multipart/form-data integration? HOT 3
- Some methods of custom URLSessionDelegate are ignored by APIClient HOT 2
- multipart/form-data example
- Problem with Pulse
- How to globally set a common group of header HOT 1
- Is there a throttle feature to avoid duplicate call? HOT 1
- Error of No such module 'Get'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from get.