-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Better modeling for KVO collection changes #1032
Changes from all commits
e5d6b03
2e93ed2
21a6d22
7f192cb
cfe938b
4536c42
6b0eba3
127ed6f
77100a8
dd5f95b
cb5051f
f5ea914
d7cfc81
ce1f42e
2c52b4c
26911ec
f141125
c5cb0c6
fc0fcea
408f4e2
4a0ca3a
3574c85
d6857bf
7ffbcdb
fceaa56
eff69df
70384d5
e220be7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// NSTableView+RACSupport.h | ||
// ReactiveCocoa | ||
// | ||
// Created by Justin Spahr-Summers on 2014-01-01. | ||
// Copyright (c) 2014 GitHub, Inc. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
@class RACDisposable; | ||
@class RACSignal; | ||
|
||
@interface NSTableView (RACSupport) | ||
|
||
/// Automatically inserts, removes, and reloads rows in the table view, based on | ||
/// the ordered collection mutations received from the given signal. | ||
/// | ||
/// This method only supports view-based table views. | ||
/// | ||
/// orderedMutations - A signal of <RACOrderedCollectionMutation> objects | ||
/// describing the indexes that should be updated in the | ||
/// table view. The actual objects being modified are | ||
/// ignored. This signal should never error. | ||
/// insertionOptions - Options describing how insertions into the table view | ||
/// should be animated. | ||
/// removalOptions - Options describing how removals from the table view | ||
/// should be animated. | ||
/// | ||
/// Returns a disposable which can be used to cancel the binding. | ||
- (RACDisposable *)rac_animateOrderedMutations:(RACSignal *)orderedMutations withInsertionAnimation:(NSTableViewAnimationOptions)insertionOptions removalAnimation:(NSTableViewAnimationOptions)removalOptions; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd be nice if the animations parameters (here and elsewhere) were signals since it seems likely you won't always want animations. But I'm happy to merge this without it for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I designed these APIs to be super simple. It's easy enough to implement this by hand that it'd be totally appropriate to reinvent for special behaviors w.r.t. animations, or updating multiple parts of a |
||
|
||
@end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pattern reminds me of
RAC(…) = RACObserve(…)
. What are your thoughts on similar macros?(macro names for illustration)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collection updates are comparatively uncommon, and we already get flak for the common macros. I'd rather not bloat the framework further with more.