Skip to content
This repository was archived by the owner on Dec 5, 2019. It is now read-only.

Commit 0a8658d

Browse files
committed
Remove RVMViewModel.model
Not every view model has a model, so the base class probably shouldn’t declare it.
1 parent f43cffc commit 0a8658d

File tree

3 files changed

+4
-32
lines changed

3 files changed

+4
-32
lines changed

ReactiveViewModel/RVMViewModel.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@
1010

1111
@class RACSignal;
1212

13-
// Adapts a domain model to be user-presentable, and implements behaviors that
14-
// drive the UI.
13+
// Implements behaviors that drive the UI, and/or adapts a domain model to be
14+
// user-presentable.
1515
@interface RVMViewModel : NSObject
1616

17-
// The model which the view model is adapting for the UI.
18-
@property (nonatomic, readonly, strong) id model;
19-
2017
// Whether the view model is currently "active."
2118
//
2219
// This generally implies that the associated view is visible. When set to NO,
@@ -39,16 +36,6 @@
3936
// upon subscription.
4037
@property (nonatomic, strong, readonly) RACSignal *didBecomeInactiveSignal;
4138

42-
// Calls -initWithModel: with a nil model.
43-
- (instancetype)init;
44-
45-
// Creates a new view model with the given model.
46-
//
47-
// model - The model to adapt for the UI. This argument may be nil.
48-
//
49-
// Returns an initialized view model, or nil if an error occurs.
50-
- (instancetype)initWithModel:(id)model;
51-
5239
// Subscribes (or resubscribes) to the given signal whenever
5340
// `didBecomeActiveSignal` fires.
5441
//

ReactiveViewModel/RVMViewModel.m

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,6 @@ - (RACSignal *)didBecomeInactiveSignal {
8080
return _didBecomeInactiveSignal;
8181
}
8282

83-
#pragma mark Lifecycle
84-
85-
- (id)init {
86-
return [self initWithModel:nil];
87-
}
88-
89-
- (id)initWithModel:(id)model {
90-
self = [super init];
91-
if (self == nil) return nil;
92-
93-
_model = model;
94-
95-
return self;
96-
}
97-
9883
#pragma mark Activation
9984

10085
- (RACSignal *)forwardSignalWhileActive:(RACSignal *)signal {

ReactiveViewModelTests/RVMViewModelSpec.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
__block RVMTestViewModel *viewModel;
1414

1515
beforeEach(^{
16-
viewModel = [[RVMTestViewModel alloc] initWithModel:@"foobar"];
16+
viewModel = [[RVMTestViewModel alloc] init];
1717
});
1818

1919
describe(@"active property", ^{
@@ -79,7 +79,7 @@
7979
deallocated = NO;
8080

8181
createViewModel = ^{
82-
RVMTestViewModel *viewModel = [[RVMTestViewModel alloc] initWithModel:nil];
82+
RVMTestViewModel *viewModel = [[RVMTestViewModel alloc] init];
8383
[viewModel.rac_deallocDisposable addDisposable:[RACDisposable disposableWithBlock:^{
8484
deallocated = YES;
8585
}]];

0 commit comments

Comments
 (0)