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

Add PublishedOnLane #2

Merged
merged 2 commits into from Mar 4, 2020
Merged

Add PublishedOnLane #2

merged 2 commits into from Mar 4, 2020

Conversation

@cliss
Copy link

cliss commented Feb 28, 2020

PublishedOnLane is a property wrapper that performs two tasks:

  • Creates a Publisher for the given property (much like @Published does)
  • Adds that Publisher to a Timelane lane

Example usage:

@PublishedOnLane(laneName: "Album List") var albumList: [PhotoAlbum] = []
@PublishedOnLane(laneName: "Album ID") var albumId: String? = nil
@PublishedOnLane(laneName: "Photos") var photos: [PHAsset] = []

// Elsewhere, you can do something like:

func foo() {
    self.$albumList.sink { /* whatever */ }.store(in: self.cancellables)
}

Should #1 land, I'll take a stab at adding support for formatters in a subsequent PR.

@cliss

This comment has been minimized.

Copy link
Author

cliss commented Feb 28, 2020

I should note I stole this code from my own project and have not run it within the context of TimelaneCombine.

...#yolo

@cliss

This comment has been minimized.

Copy link
Author

cliss commented Feb 28, 2020

Okay, just tried by pulling my fork and pointing SPM at master and all seems to work. 😅

@icanzilb

This comment has been minimized.

Copy link
Owner

icanzilb commented Feb 28, 2020

OH SNAP! This is AMAZING 👏🏼

@icanzilb

This comment has been minimized.

Copy link
Owner

icanzilb commented Mar 4, 2020

As said earlier @cliss this is amazing :) I'll merge it now with the comment that I'll remove the laneName argument name and leave it unnamed to align the API with the lane operator which takes the name directly like so lane("My Lane").

@icanzilb icanzilb merged commit 677aba5 into icanzilb:master Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.