Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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)
}
}
```