Skip to content

Commit fb951db

Browse files
author
Larry Tin
committed
Add subspecs: MVP and UIViewController
1 parent d625a68 commit fb951db

20 files changed

Lines changed: 1847 additions & 18 deletions

Example/GDDataDrivenView/GDDCollectionViewEmbeddedInTableViewCellPresenter.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#import "GDDCollectionViewLayout.h"
1010
#import "GDDSampleCollectionViewCellRender.h"
1111
#import "NSObject+GDChannel.h"
12+
#import "GDDModel.h"
1213

1314
@interface GDDCollectionViewEmbeddedInTableViewCellPresenter ()
1415
@property(nonatomic, weak) GDDViewController *owner;
@@ -24,12 +25,11 @@ - (instancetype)initWithOwner:(id)owner {
2425
return [self init];
2526
}
2627

27-
- (void)update:(GDDCollectionViewEmbeddedInTableViewCellRender *)render withModel:(GDDModel *)model {
28-
NSString *layoutTopic = [NSString stringWithFormat:@"%@/%@/%@", self.owner.topic, @"layouts", model.mid];
28+
- (void)update:(GDDCollectionViewEmbeddedInTableViewCellRender *)render withData:(NSDictionary *)data {
29+
NSString *layoutTopic = [NSString stringWithFormat:@"%@/%@/%@", self.owner.topic, @"layouts", [[NSUUID alloc] init].UUIDString];
2930
self.layout = [[GDDCollectionViewLayout alloc] initWithCollectionView:
3031
render.collectionView withTopic:layoutTopic withOwner:self.owner];
3132

32-
NSDictionary *data = model.data;
3333
NSArray *images = data[@"images"];
3434
NSMutableArray<GDDModel *> *models = @[].mutableCopy;
3535
for (NSString *image in images) {

Example/GDDataDrivenView/GDDSampleCellPresenter.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ - (instancetype)initWithOwner:(GDDViewController *)owner {
1818
return [self init];
1919
}
2020

21-
- (void)update:(GDDSampleCellRender *)render withModel:(GDDModel *)model {
21+
- (void)update:(GDDSampleCellRender *)render withData:(NSDictionary *)data {
2222
static int a;
2323
a++;
2424
NSLog(@"%s: %d", __PRETTY_FUNCTION__, a);
2525

26-
NSDictionary *data = model.data;
2726
render.titleLabel.text = data[@"title"];
2827
render.contentLabel.text = data[@"content"];
2928
render.usernameLabel.text = data[@"username"];
@@ -33,7 +32,7 @@ - (void)update:(GDDSampleCellRender *)render withModel:(GDDModel *)model {
3332

3433
__weak GDDSampleCellPresenter *weakSelf = self;
3534
render.tapHandler = ^{
36-
[weakSelf.owner appendToLastRow:model];
35+
// [weakSelf.owner appendToLastRow:model];
3736
};
3837
}
3938

Example/GDDataDrivenView/GDDSampleCollectionViewCellPresenter.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ @implementation GDDSampleCollectionViewCellPresenter {
1010

1111
}
1212

13-
- (void)update:(GDDSampleCollectionViewCellRender *)render withModel:(GDDModel *)model {
14-
NSString *image = model.data;
15-
render.imageView.image = [UIImage imageNamed:image];
13+
- (void)update:(GDDSampleCollectionViewCellRender *)render withData:(NSString *)data {
14+
render.imageView.image = [UIImage imageNamed:data];
1615
}
1716

1817
@end

Example/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
target 'GDDataDrivenView_Example' do
22
pod 'GDDataDrivenView', :path => '../'
3-
pod 'GDChannel', :git => 'https://github.com/goodow/GDChannel.git', :branch => 'mqtt'
3+
pod 'GDChannel', :git => 'https://github.com/goodow/GDChannel.git'
44
# pod 'UITableView+FDTemplateLayoutCell', '~> 1.5.beta'
55
target 'GDDataDrivenView_Tests' do
66
inherit! :search_paths

Example/Podfile.lock

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
PODS:
2+
- Aspects (1.4.1)
23
- Expecta (1.0.5)
34
- Expecta+Snapshots (3.0.0):
45
- Expecta (~> 1.0)
@@ -10,8 +11,18 @@ PODS:
1011
- MQTTKit (~> 0.1.0)
1112
- Protobuf (~> 3.0)
1213
- GDDataDrivenView (0.1.0):
14+
- GDDataDrivenView/Core (= 0.1.0)
15+
- GDDataDrivenView/MVP (= 0.1.0)
16+
- GDDataDrivenView/UIViewController (= 0.1.0)
17+
- GDDataDrivenView/Core (0.1.0):
1318
- GDChannel (~> 0.6)
19+
- GDDataDrivenView/MVP
1420
- SVPullToRefresh (~> 0.4)
21+
- GDDataDrivenView/MVP (0.1.0)
22+
- GDDataDrivenView/UIViewController (0.1.0):
23+
- Aspects (~> 1.4.1)
24+
- GDChannel (~> 0.6)
25+
- GDDataDrivenView/MVP
1526
- Mantle (2.0.7):
1627
- Mantle/extobjc (= 2.0.7)
1728
- Mantle/extobjc (2.0.7)
@@ -23,34 +34,34 @@ PODS:
2334
DEPENDENCIES:
2435
- Expecta
2536
- Expecta+Snapshots
26-
- GDChannel (from `https://github.com/goodow/GDChannel.git`, branch `mqtt`)
37+
- GDChannel (from `https://github.com/goodow/GDChannel.git`)
2738
- GDDataDrivenView (from `../`)
2839
- Specta
2940

3041
EXTERNAL SOURCES:
3142
GDChannel:
32-
:branch: mqtt
3343
:git: https://github.com/goodow/GDChannel.git
3444
GDDataDrivenView:
3545
:path: ../
3646

3747
CHECKOUT OPTIONS:
3848
GDChannel:
39-
:commit: 9c4c59d95e4a338b762abf1a395ebd1486d0920e
49+
:commit: 1148b350a207c524c49ad0122ce4fb65230a6d72
4050
:git: https://github.com/goodow/GDChannel.git
4151

4252
SPEC CHECKSUMS:
53+
Aspects: 7595ba96a6727a58ebcbfc954497fc5d2fdde546
4354
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
4455
Expecta+Snapshots: c343f410c7a6392f3e22e78f94c44b6c0749a516
4556
FBSnapshotTestCase: 918c55861356ee83aee7843d759f55a18ff6982b
4657
GDChannel: e26b61a1f156eb4b657516d80d90bdad2db46c56
47-
GDDataDrivenView: de21373f20bf7f39f8d62d2db5332aeb727a2786
58+
GDDataDrivenView: 131234691a702326e9f5d2631dd5187bdde0fbb2
4859
Mantle: bc40bb061d8c2c6fb48d5083e04d928c3b7f73d9
4960
MQTTKit: a4e6b8aa92db1aeae917d2b773fd72a7749937c4
5061
Protobuf: c032ce1bdf7a266acfd640fbfd8bdb166127c7f5
5162
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
5263
SVPullToRefresh: ba2e718695a43253d8bea6852d2960097dc15d8c
5364

54-
PODFILE CHECKSUM: 4d5753cec3e29b0097551e151c866fc153764d63
65+
PODFILE CHECKSUM: 19eae2f29ee302412e409736c977a408d65a641e
5566

5667
COCOAPODS: 1.0.1

GDDataDrivenView.podspec

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,24 @@ TODO: Add long description of the pod here.
3838

3939
# s.public_header_files = 'Pod/Classes/**/*.h'
4040
# s.frameworks = 'UIKit', 'MapKit'
41-
s.dependency 'GDChannel', '~> 0.6'
42-
s.dependency 'SVPullToRefresh', '~> 0.4'
41+
42+
s.subspec 'MVP' do |sp|
43+
sp.source_files = 'GDDataDrivenView/Classes/MVP/**/*'
44+
end
45+
46+
s.subspec 'Core' do |sp|
47+
sp.dependency 'GDDataDrivenView/MVP'
48+
sp.dependency 'GDChannel', '~> 0.6'
49+
sp.dependency 'SVPullToRefresh', '~> 0.4'
50+
sp.source_files = 'GDDataDrivenView/Classes/Model/**/*', 'GDDataDrivenView/Classes/Layout/**/*', 'GDDataDrivenView/Classes/Renders/**/*'
51+
end
52+
53+
s.subspec 'UIViewController' do |sp|
54+
sp.dependency 'GDDataDrivenView/MVP'
55+
sp.dependency 'GDChannel', '~> 0.6'
56+
sp.dependency 'Aspects', '~> 1.4.1'
57+
58+
sp.source_files = 'GDDataDrivenView/Classes/UIViewController/**/*'
59+
sp.requires_arc = ['GDDataDrivenView/Classes/UIViewController/GDDViewControllerHelper.*', 'GDDataDrivenView/Classes/UIViewController/UIViewController+GDDataDrivenView.*']
60+
end
4361
end

GDDataDrivenView/Classes/Layout/GDDCollectionViewDataSource.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#import "GDDCollectionViewDataSource.h"
66
#import "GDDRender.h"
77
#import "GDDCollectionViewLayout.h"
8+
#import "GDDModel.h"
89

910
@interface GDDCollectionViewDataSource ()
1011
@property(nonatomic, weak) GDDCollectionViewLayout *layout;

GDDataDrivenView/Classes/Model/GDDPresenter.h renamed to GDDataDrivenView/Classes/MVP/GDDPresenter.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//
44

55
#import <Foundation/Foundation.h>
6-
#import "GDDModel.h"
76

87
@protocol GDDRender;
98

File renamed without changes.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// Created by Larry Tin on 15/4/30.
3+
//
4+
5+
#import <UIKit/UIKit.h>
6+
#import "GDCMessage.h"
7+
#import "NSObject+GDChannel.h"
8+
#import "GoodowBool.pbobjc.h"
9+
#import "GoodowExtrasOption.pbobjc.h"
10+
#import "UIViewController+GDDataDrivenView.h"
11+
12+
NS_ASSUME_NONNULL_BEGIN
13+
@interface GDDViewControllerHelper : NSObject
14+
15+
+ (UIViewController *)topViewController;
16+
17+
+ (UIViewController *)backViewController;
18+
19+
+ (void)show:(UIViewController *)controller message:(id <GDCMessage>)message;
20+
21+
+ (void)config:(UIViewController *)controller viewOptions:(GDDPBViewOption *)viewOption;
22+
23+
+ (UIViewController *)findViewController:(Class)viewControllerClass;
24+
25+
+ (void)aspect_hookSelector;
26+
@end
27+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)