Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

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

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

Conversation

@pauljohanneskraft
Copy link
Collaborator

@pauljohanneskraft pauljohanneskraft commented May 4, 2021
edited
Loading

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

@quick-mischa-bird quick-mischa-bird May 5, 2021

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

@quick-mischa-bird quick-mischa-bird May 5, 2021

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

@quick-mischa-bird quick-mischa-bird May 5, 2021

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

Reviewers

1 more reviewer

@quick-mischa-bird quick-mischa-bird quick-mischa-bird left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /