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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f63d3d600a323f49c0d30b5ce4bffb88d588963f
4
- data.tar.gz: bb2773bac66525a309dcb13e5e1b9a3d49aaffc9
3
+ metadata.gz: 57e481b334e4e929326fdb7b3552341d6aba3fb9
4
+ data.tar.gz: 91ffbdeee7885f026dbf6c98394624b54ee0024c
5
5
  SHA512:
6
- metadata.gz: 57a82ac765eede2fe27dbc8cae1d1e8110140bb2c0efc18bba561ae360dfb93d1c2d2752e1c992bd5c5aabc6cd1d81a617f76e962941f79c19e3327e1930b8dd
7
- data.tar.gz: fe635ff1a3d51544fe87f3209895888899e788f15c67d89ce54a5666ac77334cc9b85c78385a36a9416df2e740c520f67962ff468eebf5800bfdedfeac26e36a
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 VIPERWireframe;
9
+ @class VIPERWireFrame;
10
10
 
11
11
  @interface VIPERPresenter : NSObject <VIPERPresenterProtocol, VIPERInteractorOutputProtocol>
12
12
 
13
13
  // Properties
14
- @property (nonatomic, strong) UIViewController <VIPERViewControllerProtocol> * viewController;
14
+ @property (nonatomic, weak) id <VIPERViewProtocol> view;
15
15
  @property (nonatomic, strong) id <VIPERInteractorInputProtocol> interactor;
16
- @property (nonatomic, strong) VIPERWireframe *wireFrame;
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 VIPERViewControllerProtocol;
10
+ @protocol VIPERInteractorOutputProtocol;
11
+ @protocol VIPERInteractorInputProtocol;
12
+ @protocol VIPERViewProtocol;
11
13
  @protocol VIPERPresenterProtocol;
12
14
  @protocol VIPERDataManagerInputProtocol;
13
15
  @class VIPERWireFrame;
14
16
 
15
- @protocol VIPERInteractorOutputProtocol
16
-
17
- @end
17
+ typedef void (^CompletionBlock)(NSError **error);
18
18
 
19
- @protocol VIPERInteractorInputProtocol
19
+ @protocol VIPERViewProtocol
20
20
  @required
21
- - (void)setPresenter:(id <VIPERPresenterProtocol>)presenter;
22
- - (id <VIPERPresenterProtocol>)presenter;
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
- - (void)setViewController:(id <VIPERViewControllerProtocol>) viewController;
28
- - (id <VIPERViewControllerProtocol>)viewController;
29
- - (void)setInteractor:(id <VIPERInteractorInputProtocol, VIPERDataManagerOutputProtocol>)interactor;
30
- - (id <VIPERInteractorInputProtocol, VIPERDataManagerOutputProtocol>)interactor;
31
- - (void)setWireFrame:(VIPERWireFrame*)wireFrame;
32
- - (VIPERWireFrame*)wireFrame;
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 VIPERViewControllerProtocol
37
+ @protocol VIPERInteractorOutputProtocol
38
+ /**
39
+ * Add here your methods for communication INTERACTOR -> PRESENTER
40
+ */
41
+ @end
42
+
43
+ @protocol VIPERInteractorInputProtocol
36
44
  @required
37
- - (void)setPresenter:(id<VIPERPresenterProtocol, VIPERInteractorOutputProtocol>)presenter;
38
- - (id<VIPERPresenterProtocol, VIPERInteractorOutputProtocol>)presenter;
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
- - (void)setInteractor:(id <VIPERDataManagerOutputProtocol>)interactor;
43
- - (id <VIPERDataManagerOutputProtocol>)interactor;
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
- - (void)setDataManager:(id<VIPERDataManagerInputProtocol>)dataManager;
48
- - (id<VIPERDataManagerInputProtocol>)dataManager;
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 <VIPERViewControllerProtocol>
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) UIViewController *viewController;
17
+ @property (nonatomic, weak) id view;
18
18
 
19
- + (void)presentVIPERModuleFrom:(UIViewController*)fromViewController;
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
- UIViewController <VIPERViewControllerProtocol> *viewController;
13
- viewController = [[VIPERViewController alloc] init];
14
- viewController.presenter = [VIPERPresenter new];
15
- viewController.presenter.interactor = [VIPERInteractor new];
16
- viewController.presenter.interactor.presenter = viewController.presenter;
17
- viewController.presenter.viewController = viewController;
18
- viewController.presenter.wireFrame = [VIPERWireFrame new];
19
- viewController.presenter.interactor.dataManager = [VIPERDataManager new];
20
- viewController.presenter.interactor.dataManager.interactor = viewController.presenter.interactor;
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
- import Foundation
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 viewController: VIPERViewControllerProtocol { get set }
29
- var interactor: VIPERDataManagerOutputProtocol { get set }
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 VIPERViewControllerProtocol
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
- @protocol VIPERDataManagerOutputProtocol;
54
- @protocol VIPERViewControllerProtocol;
55
- @protocol VIPERPresenterProtocol;
56
- @protocol VIPERDataManagerInputProtocol;
57
- @class VIPERWireFrame;
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
+ }
@@ -1,4 +1,4 @@
1
1
  module Vipergen
2
2
  NAME = "vipergen"
3
- VERSION = "0.1.9"
3
+ VERSION = "0.2.0"
4
4
  end
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.1.9
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-09-11 00:00:00.000000000 Z
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
- }
@@ -1,13 +0,0 @@
1
- //
2
- // VIPERWireframe.swift
3
- // VIPERGenDemo
4
- //
5
- // Created by Pedro Piñera Buendia on 06/09/14.
6
- // Copyright (c) 2014 ___Redbooth___. All rights reserved.
7
- //
8
-
9
- import Foundation
10
-
11
- class VIPERWireframe {
12
-
13
- }