Skip to content

Commit

Permalink
Removed contentArray property from MMFlowViewContentBinder
Browse files Browse the repository at this point in the history
- observedItems replaces contentArray
  • Loading branch information
mmllr committed Apr 5, 2014
1 parent 353b712 commit 19924d5
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Classes/osx/MMFlowView+MMFlowViewContentBinderDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ - (void)contentBinder:(MMFlowViewContentBinder *)contentBinder itemChanged:(id<M

- (void)contentArrayDidChange:(MMFlowViewContentBinder *)contentBinder
{
self.contentAdapter = contentBinder.contentArray;
self.contentAdapter = contentBinder.observedItems;
[self reloadContent];
}

Expand Down
3 changes: 1 addition & 2 deletions Classes/osx/MMFlowViewContentBinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ void * const kMFlowViewContentBinderItemObservationContext;

@property (nonatomic, weak) id<MMFlowViewContentBinderDelegate> delegate;
@property (nonatomic, readonly, copy) NSString *contentArrayKeyPath;
@property (nonatomic, readonly, copy) NSArray *contentArray;
@property (nonatomic, readonly) NSArray *observedItems;
@property (nonatomic, readonly, copy) NSArray *observedItems;
@property (nonatomic, readonly) NSArray *observedItemKeys;
@property (nonatomic, readonly) NSDictionary *bindingInfo;

Expand Down
9 changes: 1 addition & 8 deletions Classes/osx/MMFlowViewContentBinder.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
@interface MMFlowViewContentBinder ()

@property (nonatomic, strong) NSArrayController *controller;
@property (nonatomic, readwrite) NSArray *observedItems;
@property (nonatomic, readwrite, copy) NSArray *observedItems;
@property (nonatomic, readwrite, strong) NSDictionary *bindingInfo;

@end

@implementation MMFlowViewContentBinder

@dynamic contentArray;
@dynamic observedItemKeys;

- (instancetype)init
Expand All @@ -43,7 +42,6 @@ - (instancetype)initWithArrayController:(NSArrayController *)controller withCont
if (self) {
_controller = controller;
_contentArrayKeyPath = [keyPath copy];
_observedItems = nil;
_bindingInfo = @{NSObservedObjectKey: controller,
NSObservedKeyPathKey: [keyPath copy],
NSOptionsKey: @{} };
Expand All @@ -67,11 +65,6 @@ - (NSArray*)observedItemKeys
return mandantoryKeys;
}

- (NSArray*)contentArray
{
return [[self.controller valueForKeyPath:self.contentArrayKeyPath] copy];
}

- (void)startObservingContent
{
[self.controller addObserver:self
Expand Down
2 changes: 0 additions & 2 deletions Classes/osx/MMFlowView_Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@
@property (strong,nonatomic) CALayer *highlightedLayer;
@property (strong,readwrite) MMScrollBarLayer *scrollBarLayer;
@property (strong) MMFlowViewImageFactory *imageFactory;
@property (strong,nonatomic,readwrite) NSDictionary *contentArrayBindingInfo;
@property (nonatomic,copy) NSArray *observedItems;
@property (readwrite,nonatomic) NSUInteger numberOfItems;
@property (readwrite,strong) id<MMFlowViewImageCache> imageCache;
@property (nonatomic, readonly) NSRect selectedItemFrame;
Expand Down
4 changes: 2 additions & 2 deletions Classes/osx/Specs/MMFlowViewContentBinderDelegateSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
beforeEach(^{
sut = [[MMFlowView alloc] initWithFrame:NSMakeRect(0, 0, 400, 300)];
contentBinderMock = [KWMock nullMockForClass:[MMFlowViewContentBinder class]];
[contentBinderMock stub:@selector(contentArray) andReturn:contentArray];
[contentBinderMock stub:@selector(observedItems) andReturn:contentArray];
});
afterEach(^{
sut = nil;
Expand Down Expand Up @@ -51,7 +51,7 @@
it(@"should set the contentAdapter to the contentBinders contentArray", ^{
[sut contentArrayDidChange:contentBinderMock];

[[sut.contentAdapter should] equal:contentBinderMock.contentArray];
[[sut.contentAdapter should] equal:contentBinderMock.observedItems];
});
});

Expand Down
4 changes: 0 additions & 4 deletions Classes/osx/Specs/MMFlowViewContentBinderSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@
[[sut.contentArrayKeyPath should] equal:arrangedObjectsKey];
});

it(@"should have an empty contentArray", ^{
[[sut.contentArray should] haveCountOf:numberOfItems];
});

it(@"should have no observedItems", ^{
[[sut.observedItems should] beNil];
});
Expand Down

0 comments on commit 19924d5

Please sign in to comment.