Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thomasleese/combine-requests
Helpers for working with requests in Combine.
https://github.com/thomasleese/combine-requests
combine requests swift swiftui
Last synced: about 6 hours ago
JSON representation
Helpers for working with requests in Combine.
- Host: GitHub
- URL: https://github.com/thomasleese/combine-requests
- Owner: thomasleese
- License: mit
- Created: 2020-10-18T07:14:00.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2020-10-27T07:43:49.000Z (about 4 years ago)
- Last Synced: 2023-08-04T00:51:45.504Z (over 1 year ago)
- Topics: combine, requests, swift, swiftui
- Language: Swift
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: Changelog.md
- License: License.md
Awesome Lists containing this project
README
# Combine Requests
Helpers for working with requests in Combine.
## Example
```swift
class TodosStore: ObservableRequest {
public func fetch() {
URLSession.shared
.dataTaskPublisher(for: URL(string: "https://jsonplaceholder.typicode.com/todos")!)
.assignRequest(to: self)
}
}struct ExercisesView: View {
@StateObject private var todos = TodosStore()var body: some View {
List(todos.output ?? []) { todo in
Text("\(todo.title)")
}.onAppear(perform: todos.fetch)
}
}
```