vipergen 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/templates/default/objc/Presenter/VIPERPresenter.h +3 -3
- data/lib/templates/default/objc/Protocols/VIPERProtocols.h +35 -20
- data/lib/templates/default/objc/ViewController/VIPERViewController.h +1 -1
- data/lib/templates/default/objc/WireFrame/VIPERWireFrame.h +2 -2
- data/lib/templates/default/objc/WireFrame/VIPERWireFrame.m +17 -10
- data/lib/templates/default/swift/Protocols/VIPERProtocols.swift +23 -64
- data/lib/vipergen/version.rb +1 -1
- metadata +2 -4
- data/lib/templates/default/swift/DataManager/VIPERDataManager.swift +0 -17
- data/lib/templates/default/swift/WireFrame/VIPERWireframe.swift +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57e481b334e4e929326fdb7b3552341d6aba3fb9
|
4
|
+
data.tar.gz: 91ffbdeee7885f026dbf6c98394624b54ee0024c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec4be53a4f8552ef8d29ee80ae091f0a88b00617479577788028b3fd56309c5be81fe3dfe36a8a9643d8e576dbb01a0b434e7302676958410f276a93a4d9de9b
|
7
|
+
data.tar.gz: f5632d720eb3d684b6d0244b23ebb9312cbe71ef0dcb2c5c94d950b0cddb27f9202fd674c51a48c6ce545e3dedd5ce93932d44828767f5b6c74736b2e0a4ad03
|
@@ -6,13 +6,13 @@
|
|
6
6
|
#import <Foundation/Foundation.h>
|
7
7
|
#import "VIPERProtocols.h"
|
8
8
|
|
9
|
-
@class
|
9
|
+
@class VIPERWireFrame;
|
10
10
|
|
11
11
|
@interface VIPERPresenter : NSObject <VIPERPresenterProtocol, VIPERInteractorOutputProtocol>
|
12
12
|
|
13
13
|
// Properties
|
14
|
-
@property (nonatomic,
|
14
|
+
@property (nonatomic, weak) id <VIPERViewProtocol> view;
|
15
15
|
@property (nonatomic, strong) id <VIPERInteractorInputProtocol> interactor;
|
16
|
-
@property (nonatomic, strong)
|
16
|
+
@property (nonatomic, strong) VIPERWireFrame *wireFrame;
|
17
17
|
|
18
18
|
@end
|
@@ -7,43 +7,58 @@
|
|
7
7
|
#import <UIKit/UIKit.h>
|
8
8
|
|
9
9
|
@protocol VIPERDataManagerOutputProtocol;
|
10
|
-
@protocol
|
10
|
+
@protocol VIPERInteractorOutputProtocol;
|
11
|
+
@protocol VIPERInteractorInputProtocol;
|
12
|
+
@protocol VIPERViewProtocol;
|
11
13
|
@protocol VIPERPresenterProtocol;
|
12
14
|
@protocol VIPERDataManagerInputProtocol;
|
13
15
|
@class VIPERWireFrame;
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
@end
|
17
|
+
typedef void (^CompletionBlock)(NSError **error);
|
18
18
|
|
19
|
-
@protocol
|
19
|
+
@protocol VIPERViewProtocol
|
20
20
|
@required
|
21
|
-
|
22
|
-
|
21
|
+
@property (nonatomic, strong) id <VIPERPresenterProtocol> presenter;
|
22
|
+
/**
|
23
|
+
* Add here your methods for communication VIEWCONTROLLER -> PRESENTER
|
24
|
+
*/
|
23
25
|
@end
|
24
26
|
|
25
27
|
@protocol VIPERPresenterProtocol
|
26
28
|
@required
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
@property (nonatomic, weak) id <VIPERViewProtocol> view;
|
30
|
+
@property (nonatomic, strong) id <VIPERInteractorInputProtocol> interactor;
|
31
|
+
@property (nonatomic, strong) VIPERWireFrame *wireFrame;
|
32
|
+
/**
|
33
|
+
* Add here your methods for communication VIEWCONTROLLER/WIREFRAME -> PRESENTER
|
34
|
+
*/
|
33
35
|
@end
|
34
36
|
|
35
|
-
@protocol
|
37
|
+
@protocol VIPERInteractorOutputProtocol
|
38
|
+
/**
|
39
|
+
* Add here your methods for communication INTERACTOR -> PRESENTER
|
40
|
+
*/
|
41
|
+
@end
|
42
|
+
|
43
|
+
@protocol VIPERInteractorInputProtocol
|
36
44
|
@required
|
37
|
-
|
38
|
-
|
45
|
+
@property (nonatomic, weak) id <VIPERInteractorOutputProtocol> presenter;
|
46
|
+
/**
|
47
|
+
* Add here your methods for communication PRESENTER -> INTERACTOR
|
48
|
+
*/
|
39
49
|
@end
|
40
50
|
|
51
|
+
|
41
52
|
@protocol VIPERDataManagerInputProtocol
|
42
|
-
|
43
|
-
|
53
|
+
@property (nonatomic, weak) id <VIPERDataManagerOutputProtocol> interactor;
|
54
|
+
/**
|
55
|
+
* Add here your methods for communication INTERACTOR -> DATAMANAGER
|
56
|
+
*/
|
44
57
|
@end
|
45
58
|
|
46
59
|
@protocol VIPERDataManagerOutputProtocol
|
47
|
-
|
48
|
-
|
60
|
+
@property (nonatomic, strong) id <VIPERDataManagerInputProtocol> dataManager;
|
61
|
+
/**
|
62
|
+
* Add here your methods for communication DATAMANAGER -> INTERACTOR
|
63
|
+
*/
|
49
64
|
@end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#import <UIKit/UIKit.h>
|
7
7
|
#import "VIPERProtocols.h"
|
8
8
|
|
9
|
-
@interface VIPERViewController : UIViewController <
|
9
|
+
@interface VIPERViewController : UIViewController <VIPERViewProtocol>
|
10
10
|
|
11
11
|
@property (nonatomic, strong) id <VIPERPresenterProtocol> presenter;
|
12
12
|
|
@@ -14,8 +14,8 @@
|
|
14
14
|
|
15
15
|
@interface VIPERWireFrame : NSObject
|
16
16
|
|
17
|
-
@property (nonatomic, weak)
|
17
|
+
@property (nonatomic, weak) id view;
|
18
18
|
|
19
|
-
+ (void)presentVIPERModuleFrom:(
|
19
|
+
+ (void)presentVIPERModuleFrom:(id)fromView;
|
20
20
|
|
21
21
|
@end
|
@@ -9,17 +9,24 @@
|
|
9
9
|
|
10
10
|
+ (void)presentVIPERModuleFrom:(UIViewController*)fromViewController
|
11
11
|
{
|
12
|
-
|
13
|
-
viewController = [[VIPERViewController alloc] init];
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
viewController.presenter
|
12
|
+
// Generating module components
|
13
|
+
UIViewController <VIPERViewProtocol> *viewController = [[VIPERViewController alloc] init];
|
14
|
+
id <VIPERPresenterProtocol, VIPERInteractorOutputProtocol> presenter = [VIPERPresenter new];
|
15
|
+
id <VIPERInteractorInputProtocol, VIPERDataManagerOutputProtocol> interactor = [VIPERInteractor new];
|
16
|
+
id <VIPERDataManagerInputProtocol> dataManager = [VIPERDataManager new];
|
17
|
+
VIPERWireFrame *wireFrame = [VIPERWireFrame new];
|
18
|
+
|
19
|
+
// Connecting
|
20
|
+
viewController.presenter = presenter;
|
21
|
+
presenter.view = viewController;
|
22
|
+
presenter.wireFrame = wireFrame;
|
23
|
+
wireFrame.view = viewController;
|
24
|
+
presenter.interactor = interactor;
|
25
|
+
interactor.presenter = presenter;
|
26
|
+
interactor.dataManager = dataManager;
|
27
|
+
dataManager.interactor = interactor;
|
21
28
|
|
22
29
|
//TOODO - New view controller presentation (present, push, pop, .. )
|
23
30
|
}
|
24
31
|
|
25
|
-
@end
|
32
|
+
@end
|
@@ -6,85 +6,44 @@
|
|
6
6
|
// Copyright (c) 2014 ___Redbooth___. All rights reserved.
|
7
7
|
//
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
protocol VIPERInteractorOutputProtocol
|
13
|
-
{
|
14
|
-
/* Add your extra communication methods here */
|
15
|
-
/* Interactor -> Presenter */
|
16
|
-
}
|
17
|
-
|
18
|
-
protocol VIPERInteractorInputProtocol
|
19
|
-
{
|
20
|
-
var presenter: VIPERPresenterProtocol { get set }
|
21
|
-
|
22
|
-
/* Add your extra communication methods here */
|
23
|
-
/* Presenter -> Interactor */
|
24
|
-
}
|
9
|
+
//Problem with a bucle in protocols: http://stackoverflow.com/questions/26205809/cyclic-loop-between-protocols-in-swift
|
25
10
|
|
26
11
|
protocol VIPERPresenterProtocol
|
27
12
|
{
|
28
|
-
var
|
29
|
-
var interactor:
|
30
|
-
|
13
|
+
var view: VIPERViewProtocol? { get set }
|
14
|
+
var interactor: VIPERInteractorInputProtocol? { get set }
|
15
|
+
//var wireFrame: VIPERWireFrame? { get set }
|
16
|
+
|
31
17
|
// /* Add your extra communication methods here */
|
32
18
|
// /* Presenter -> ViewController */
|
33
19
|
}
|
34
20
|
|
35
|
-
protocol
|
21
|
+
protocol VIPERViewProtocol
|
36
22
|
{
|
37
|
-
|
23
|
+
//var presenter: VIPERPresenterProtocol? { get set }
|
38
24
|
}
|
39
25
|
|
40
26
|
protocol VIPERDataManagerInputProtocol
|
41
27
|
{
|
42
|
-
|
28
|
+
var interactor: VIPERDataManagerOutputProtocol? { get set }
|
43
29
|
}
|
44
30
|
|
45
|
-
protocol VIPERDataManagerOutputProtocol
|
46
|
-
|
31
|
+
protocol VIPERDataManagerOutputProtocol
|
32
|
+
{
|
33
|
+
//var dataManager: VIPERDataManagerInputProtocol? { get set }
|
47
34
|
}
|
48
35
|
|
49
36
|
|
37
|
+
protocol VIPERInteractorOutputProtocol
|
38
|
+
{
|
39
|
+
/* Add your extra communication methods here */
|
40
|
+
/* Interactor -> Presenter */
|
41
|
+
}
|
50
42
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
@protocol VIPERInteractorOutputProtocol
|
60
|
-
|
61
|
-
@end
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
@protocol VIPERPresenterProtocol
|
66
|
-
@required
|
67
|
-
- (void)setViewController:(id <VIPERViewControllerProtocol>) viewController;
|
68
|
-
- (id <VIPERViewControllerProtocol>)viewController;
|
69
|
-
- (void)setInteractor:(id <VIPERInteractorInputProtocol, VIPERDataManagerOutputProtocol>)interactor;
|
70
|
-
- (id <VIPERInteractorInputProtocol, VIPERDataManagerOutputProtocol>)interactor;
|
71
|
-
- (void)setWireFrame:(VIPERWireFrame*)wireFrame;
|
72
|
-
- (VIPERWireFrame*)wireFrame;
|
73
|
-
@end
|
74
|
-
|
75
|
-
@protocol VIPERViewControllerProtocol
|
76
|
-
@required
|
77
|
-
- (void)setPresenter:(id<VIPERPresenterProtocol, VIPERInteractorOutputProtocol>)presenter;
|
78
|
-
- (id<VIPERPresenterProtocol, VIPERInteractorOutputProtocol>)presenter;
|
79
|
-
@end
|
80
|
-
|
81
|
-
@protocol VIPERDataManagerInputProtocol
|
82
|
-
- (void)setInteractor:(id <VIPERDataManagerOutputProtocol>)interactor;
|
83
|
-
- (id <VIPERDataManagerOutputProtocol>)interactor;
|
84
|
-
@end
|
85
|
-
|
86
|
-
@protocol VIPERDataManagerOutputProtocol
|
87
|
-
- (void)setDataManager:(id<VIPERDataManagerInputProtocol>)dataManager;
|
88
|
-
- (id<VIPERDataManagerInputProtocol>)dataManager;
|
89
|
-
@end
|
90
|
-
*/
|
43
|
+
protocol VIPERInteractorInputProtocol
|
44
|
+
{
|
45
|
+
var presenter: VIPERInteractorOutputProtocol? { get set }
|
46
|
+
|
47
|
+
/* Add your extra communication methods here */
|
48
|
+
/* Presenter -> Interactor */
|
49
|
+
}
|
data/lib/vipergen/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vipergen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Piñera
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -103,9 +103,7 @@ files:
|
|
103
103
|
- lib/templates/default/objc/ViewController/VIPERViewController.m
|
104
104
|
- lib/templates/default/objc/WireFrame/VIPERWireFrame.h
|
105
105
|
- lib/templates/default/objc/WireFrame/VIPERWireFrame.m
|
106
|
-
- lib/templates/default/swift/DataManager/VIPERDataManager.swift
|
107
106
|
- lib/templates/default/swift/Protocols/VIPERProtocols.swift
|
108
|
-
- lib/templates/default/swift/WireFrame/VIPERWireframe.swift
|
109
107
|
- lib/templates/default/viperspec.yml
|
110
108
|
- lib/vipergen.rb
|
111
109
|
- lib/vipergen/dirutils.rb
|
@@ -1,17 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// VIPERDataManager.swift
|
3
|
-
// VIPERGenDemo
|
4
|
-
//
|
5
|
-
// Created by Pedro Piñera Buendía on 22/08/14.
|
6
|
-
// Copyright (c) 2014 ___Redbooth___. All rights reserved.
|
7
|
-
//
|
8
|
-
|
9
|
-
import Foundation
|
10
|
-
|
11
|
-
|
12
|
-
class VIPERDataManager: VIPERDataManagerInputProtocol {
|
13
|
-
init () {
|
14
|
-
self.interactor = nil
|
15
|
-
}
|
16
|
-
var interactor: VIPERDataManagerOutputProtocol?
|
17
|
-
}
|