Skip to content

Conversation

pauljohanneskraft
Copy link
Collaborator

@pauljohanneskraft pauljohanneskraft commented May 4, 2021

This change introduces a new result builder to allow for the simple creation of reactive APIs.

One will be able to create publishers using the following:

@Publish<MainQueue>
func fetchProject(name: String) -> Pipeline<Project> {
    if let project = cache[name] {
        project
    } else {
        URLSession.shared.dataTaskPublisher(for: request)
            .map(\.data)
            .decode(Project.self, from: JSONDecoder())
    }
}

@@ -0,0 +1,80 @@
//
// File.swift
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix file name.

@@ -0,0 +1,33 @@
//
// File.swift
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix file name.


public static func buildEither<P: Publisher>(second component: P) -> P {
component
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of the above two functions? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants