Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce @Publish<Modifier> resultBuilder to create Combine Publisher #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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.

None yet

2 participants