vipergen-xctestable 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +157 -0
  4. data/bin/vipergen +9 -0
  5. data/lib/templates/default/objc/DataManager/API/VIPERAPIDataManager.h +12 -0
  6. data/lib/templates/default/objc/DataManager/API/VIPERAPIDataManager.m +10 -0
  7. data/lib/templates/default/objc/DataManager/Local/VIPERLocalDataManager.h +12 -0
  8. data/lib/templates/default/objc/DataManager/Local/VIPERLocalDataManager.m +10 -0
  9. data/lib/templates/default/objc/Interactor/VIPERInteractor.h +16 -0
  10. data/lib/templates/default/objc/Interactor/VIPERInteractor.m +10 -0
  11. data/lib/templates/default/objc/Interactor/VIPERItem.h +10 -0
  12. data/lib/templates/default/objc/Interactor/VIPERItem.m +10 -0
  13. data/lib/templates/default/objc/Presenter/VIPERPresenter.h +17 -0
  14. data/lib/templates/default/objc/Presenter/VIPERPresenter.m +11 -0
  15. data/lib/templates/default/objc/Protocols/VIPERProtocols.h +80 -0
  16. data/lib/templates/default/objc/View/VIPERView.h +13 -0
  17. data/lib/templates/default/objc/View/VIPERView.m +32 -0
  18. data/lib/templates/default/objc/WireFrame/VIPERWireFrame.h +18 -0
  19. data/lib/templates/default/objc/WireFrame/VIPERWireFrame.m +32 -0
  20. data/lib/templates/default/swift/DataManager/API/VIPERAPIDataManager.swift +11 -0
  21. data/lib/templates/default/swift/DataManager/Local/VIPERLocalDataManager.swift +11 -0
  22. data/lib/templates/default/swift/Interactor/VIPERInteractor.swift +15 -0
  23. data/lib/templates/default/swift/Interactor/VIPERItem.swift +13 -0
  24. data/lib/templates/default/swift/Presenter/VIPERPresenter.swift +15 -0
  25. data/lib/templates/default/swift/Protocols/VIPERProtocols.swift +70 -0
  26. data/lib/templates/default/swift/View/VIPERView.swift +12 -0
  27. data/lib/templates/default/swift/WireFrame/VIPERWireFrame.swift +29 -0
  28. data/lib/templates/default/viperspec.yml +4 -0
  29. data/lib/templates/testable/objc/DataManager/VIPERDataManager.h +15 -0
  30. data/lib/templates/testable/objc/DataManager/VIPERDataManager.m +11 -0
  31. data/lib/templates/testable/objc/Interactor/VIPERInteractor.h +16 -0
  32. data/lib/templates/testable/objc/Interactor/VIPERInteractor.m +10 -0
  33. data/lib/templates/testable/objc/Interactor/VIPERInteractorSpec.m +31 -0
  34. data/lib/templates/testable/objc/Presenter/VIPERPresenter.h +18 -0
  35. data/lib/templates/testable/objc/Presenter/VIPERPresenter.m +11 -0
  36. data/lib/templates/testable/objc/Presenter/VIPERPresenterSpec.m +31 -0
  37. data/lib/templates/testable/objc/Protocols/VIPERProtocols.h +64 -0
  38. data/lib/templates/testable/objc/ViewController/VIPERViewController.h +13 -0
  39. data/lib/templates/testable/objc/ViewController/VIPERViewController.m +32 -0
  40. data/lib/templates/testable/objc/ViewController/VIPERViewControllerSpec.m +31 -0
  41. data/lib/templates/testable/objc/WireFrame/VIPERWireFrame.h +19 -0
  42. data/lib/templates/testable/objc/WireFrame/VIPERWireFrame.m +31 -0
  43. data/lib/templates/testable/swift/DataManager/API/VIPERAPIDataManager.swift +11 -0
  44. data/lib/templates/testable/swift/DataManager/Local/VIPERLocalDataManager.swift +11 -0
  45. data/lib/templates/testable/swift/Interactor/VIPERInteractor.swift +15 -0
  46. data/lib/templates/testable/swift/Interactor/VIPERInteractorSpec.swift +22 -0
  47. data/lib/templates/testable/swift/Presenter/VIPERPresenter.swift +15 -0
  48. data/lib/templates/testable/swift/Presenter/VIPERPresenterSpec.swift +22 -0
  49. data/lib/templates/testable/swift/Protocols/VIPERProtocols.swift +70 -0
  50. data/lib/templates/testable/swift/View/VIPERView.swift +12 -0
  51. data/lib/templates/testable/swift/View/VIPERViewSpec.swift +22 -0
  52. data/lib/templates/testable/swift/WireFrame/VIPERWireFrame.swift +31 -0
  53. data/lib/templates/testable/viperspec.yml +4 -0
  54. data/lib/templates/xctestable/objc/DataManager/VIPERDataManager.h +15 -0
  55. data/lib/templates/xctestable/objc/DataManager/VIPERDataManager.m +11 -0
  56. data/lib/templates/xctestable/objc/Interactor/VIPERInteractor.h +16 -0
  57. data/lib/templates/xctestable/objc/Interactor/VIPERInteractor.m +10 -0
  58. data/lib/templates/xctestable/objc/Interactor/VIPERInteractorSpec.m +31 -0
  59. data/lib/templates/xctestable/objc/Presenter/VIPERPresenter.h +18 -0
  60. data/lib/templates/xctestable/objc/Presenter/VIPERPresenter.m +11 -0
  61. data/lib/templates/xctestable/objc/Presenter/VIPERPresenterSpec.m +31 -0
  62. data/lib/templates/xctestable/objc/Protocols/VIPERProtocols.h +64 -0
  63. data/lib/templates/xctestable/objc/ViewController/VIPERViewController.h +13 -0
  64. data/lib/templates/xctestable/objc/ViewController/VIPERViewController.m +32 -0
  65. data/lib/templates/xctestable/objc/ViewController/VIPERViewControllerSpec.m +31 -0
  66. data/lib/templates/xctestable/objc/WireFrame/VIPERWireFrame.h +19 -0
  67. data/lib/templates/xctestable/objc/WireFrame/VIPERWireFrame.m +31 -0
  68. data/lib/templates/xctestable/swift/DataManager/API/VIPERAPIDataManager.swift +11 -0
  69. data/lib/templates/xctestable/swift/DataManager/Local/VIPERLocalDataManager.swift +11 -0
  70. data/lib/templates/xctestable/swift/Interactor/VIPERInteractor.swift +15 -0
  71. data/lib/templates/xctestable/swift/Interactor/VIPERInteractorTests.swift +29 -0
  72. data/lib/templates/xctestable/swift/Presenter/VIPERPresenter.swift +15 -0
  73. data/lib/templates/xctestable/swift/Presenter/VIPERPresenterTests.swift +29 -0
  74. data/lib/templates/xctestable/swift/Protocols/VIPERProtocols.swift +70 -0
  75. data/lib/templates/xctestable/swift/View/VIPERView.swift +12 -0
  76. data/lib/templates/xctestable/swift/View/VIPERViewTests.swift +29 -0
  77. data/lib/templates/xctestable/swift/WireFrame/VIPERWireFrame.swift +32 -0
  78. data/lib/templates/xctestable/viperspec.yml +4 -0
  79. data/lib/vipergen/dirutils.rb +17 -0
  80. data/lib/vipergen/filemanager.rb +51 -0
  81. data/lib/vipergen/generator.rb +66 -0
  82. data/lib/vipergen/templatemanager.rb +53 -0
  83. data/lib/vipergen/version.rb +4 -0
  84. data/lib/vipergen/viperthor.rb +21 -0
  85. data/lib/vipergen.rb +6 -0
  86. data/spec/spec_helper.rb +4 -0
  87. data/spec/vipergen/vipergen_spec.rb +133 -0
  88. metadata +207 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8a71f6a94281f10015bf3348df55987ad188ff13
4
+ data.tar.gz: 2036ddb12d9e6b788224d3e615fdb08da9bb84e6
5
+ SHA512:
6
+ metadata.gz: 1438cf8e5b1063abd554f3e9b847927601367314a45b443d48e685a14608c219f5bfb3e41ee8cd8c850950ea757822b7307707d6243c75761edae0c134f6ca19
7
+ data.tar.gz: 6b75244efed57001fa71839e4f61ea87b7ccbe6f556090361b7ea1393a442b3d3da7f0b88284a4a08bd58e401fe15226289590bb5c6943a0547b483c188c36c3
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Redbooth
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,157 @@
1
+ Viper Module Generator
2
+ ======================
3
+ [![Code Climate](https://codeclimate.com/github/teambox/viper-module-generator/badges/gpa.svg)](https://codeclimate.com/github/teambox/viper-module-generator)
4
+ [![Build Status](https://travis-ci.org/teambox/viper-module-generator.svg?branch=master)](https://travis-ci.org/teambox/viper-module-generator)
5
+ [![Test Coverage](https://codeclimate.com/github/teambox/viper-module-generator/badges/coverage.svg)](https://codeclimate.com/github/teambox/viper-module-generator)
6
+ [![Dependency Status](https://gemnasium.com/teambox/viper-module-generator.svg)](https://gemnasium.com/teambox/viper-module-generator)
7
+
8
+
9
+ ![image](http://www.objc.io/images/issue-13/2014-06-07-viper-intro.jpg)
10
+
11
+ Gem to generate VIPER modules to use them in your Objective-C/Swift projects
12
+ The implementation scheme returned by this generator is hardly inspired in the example and post of Objc.io, http://www.objc.io/issue-13/viper.html .
13
+
14
+ - [Features](#features)
15
+ - [Changelog](#changelog-0.1)
16
+ - [Expected in version 0.2](#expected-in-version-0.2)
17
+ - [Viper files structure](#viper-files-structure)
18
+ - [How to install vipergen](#how-to-install-vipergen)
19
+ - [How to generate a VIPER module with a given name?](#how-to-generate-viper-module-with-a-given-name?)
20
+ - [Developer tips](#developer-tips)
21
+ - [Update the gem](#update-the-gem)
22
+ - [Add a new template](#add-a-new-template)
23
+ - [Resources](#resources)
24
+
25
+ ## Features
26
+ - Generates the module in Swift and Objective-C
27
+ - Ready to be installed as a gem https://rubygems.org/gems/VIPERGen
28
+
29
+ ### Changelog 0.1.6
30
+ - Added `templates` command to know which templates are available
31
+ - YAML file in each template with the information about the template (more scalable)
32
+
33
+ ### Changelog 0.1
34
+ - Added default template
35
+ - Fully components tested
36
+
37
+ ### Changelog 0.2.3
38
+ - VIPER Example using the Twitter API
39
+ - Default template implemented in Swift
40
+ -
41
+
42
+ ### Expected in version 0.3
43
+ - Integrate with XCode as a plugin (http://nshipster.com/xcode-plugins/)
44
+
45
+ ## Viper files structure
46
+ ```bash
47
+ .objc
48
+ +-- DataManager
49
+ | +-- VIPERDataManager.h
50
+ | +-- VIPERDataManager.m
51
+ +-- Interactor
52
+ | +-- VIPERInteractor.h
53
+ | +-- VIPERInteractor.m
54
+ | +-- VIPERInteractorSpec.m
55
+ +-- Presenter
56
+ | +-- VIPERPresenter.h
57
+ | +-- VIPERPresenter.m
58
+ | +-- VIPERPresenterSpec.m
59
+ +-- ViewController
60
+ | +-- VIPERViewController.h
61
+ | +-- VIPERViewController.m
62
+ | +-- VIPERViewControllerSpec.m
63
+ +-- WireFrame
64
+ | +-- VIPERWireFrame.h
65
+ | +-- VIPERWireFrame.m
66
+ +-- Protocols
67
+ | +-- VIPERProtocols.h
68
+ .swift
69
+ +-- DataManager
70
+ | +-- VIPERDataManager.swift
71
+ +-- Interactor
72
+ | +-- VIPERInteractor.swift
73
+ | +-- VIPERInteractorSpec.swift
74
+ +-- Presenter
75
+ | +-- VIPERPresenter.swift
76
+ | +-- VIPERPresenterSpec.swift
77
+ +-- View
78
+ | +-- VIPERView.swift
79
+ | +-- VIPERViewSpec.swift
80
+ +-- WireFrame
81
+ | +-- VIPERWireFrame.swift
82
+ +-- Protocols
83
+ | +-- VIPERProtocols.swift
84
+ ```
85
+ ## How to install vipergen ?
86
+ You can install it easily as using the gem. With ruby installed in your OSX execute:
87
+ ```bash
88
+ sudo gem install vipergen-roche
89
+ ```
90
+ If everything were right, you should have now the vipergem command available in your system console
91
+
92
+ ## How to generate a VIPER module with a given name?
93
+ You have just to execute the following command
94
+ ```bash
95
+ vipergen generate MyFirstViperModule --path=~/myproject/shared
96
+ ```
97
+ And then the files structure will be automatically created. Don't forget to add this folder to your project dragging it into the XCode/Appcode inspector
98
+
99
+ ## What options are available in generator?
100
+ You have just to execute the following command
101
+ ```bash
102
+ vipergen help generate
103
+ ```
104
+ And then you will see all options available
105
+
106
+ Sample:
107
+ ```bash
108
+ vipergen generate <Module_Name> --path=<Path> --language=swift --author='michal' --template=testable --swift-module <MY_Project>
109
+ ```
110
+
111
+ ## How can I try the demo project?
112
+
113
+ 1. Clone the repo `git clone https://github.com/pepibumur/viper-module-generator.git`
114
+ 2. Move into the repo folder and update the git submodules `git sumodule update --init`
115
+ 3. In the folder VIPERGenDemo install the pods `pod install`
116
+ 4. Open the project from the `VIPERGenDemo.xcworkspace` file
117
+ 5. Enjoy it!
118
+
119
+
120
+ ## Developer tips
121
+ ### Update the gem
122
+ When the gem is updated it has to be reported to the gem repository. I followed this tutorial http://amaras-tech.co.uk/article/43/Creating_executable_gems that basically says that once you have your gem ready execute:
123
+ ```bash
124
+ gem build vipergen.gemspec
125
+ gem install vipergen-0.1.gem
126
+ gem push vipergen-0.1.gem
127
+ ```
128
+ Then you'll be asked for your credentials in order to make the update in the repo (http://guides.rubygems.org/publishing/)
129
+
130
+ ### Add a new template
131
+ Are you interested in VIPER and you would like to contribute with this gem adding new templates? Feel free to do it. It's pretty easy. You've just to:
132
+ - Create a folder inside `templates` with the name of your template
133
+ - You'll have to create inside the templates in both languages, Swift and Objective-C (get inspired from existing templates)
134
+ - Use the word VIPER where you want the name to be replaced in.
135
+ - Remember to add the file viperspec.yml with the description of your template as below:
136
+ ```yaml
137
+ author: pepi
138
+ author_email: pepibumur@gmail.com
139
+ template_description: Default template with the simplest structure using VIPER
140
+ updated_at: 2014-08-24
141
+ ```
142
+ - Report it as a PR in this repo updating the gem version in Gemspec.
143
+
144
+ ### Available Templates
145
+ - default by pepimbur
146
+ - testable by wojtysim (includes Spec file templates for Interactor, Presenter and View)
147
+
148
+ ## Resources
149
+ - Redbooth presentation: https://speakerdeck.com/sergigracia/clean-architecture-viper
150
+ - Rspec documentation: http://rubydoc.info/gems/rspec-expectations/frames
151
+ - XCode Plugins: http://nshipster.com/xcode-plugins/
152
+ - XCodeProj gem (to modify project groups structure): https://github.com/CocoaPods/Xcodeproj
153
+ - Thor, powerful Ruby library for command line: http://whatisthor.com/
154
+ - Cocoa Design Patters: https://developer.apple.com/legacy/library/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/CocoaDesignPatterns.html
155
+
156
+ ## Contact
157
+ If you have any doubt about the gem or even if you want to make any suggestion you can do it directly to my email address, pedro@redbooth.com . You can use the issues Github page too
data/bin/vipergen ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #require 'rubygems'
4
+ require 'vipergen/viperthor'
5
+
6
+ puts "------- VIPER GENERATOR---------\n"
7
+ puts ARGV
8
+ Vipergen::ViperThor.start(ARGV)
9
+ puts "--------------------------------\n"
@@ -0,0 +1,12 @@
1
+ //
2
+ // Created by AUTHOR.
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+ #import "VIPERProtocols.h"
8
+
9
+
10
+ @interface VIPERAPIDataManager : NSObject <VIPERAPIDataManagerInputProtocol>
11
+
12
+ @end
@@ -0,0 +1,10 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import "VIPERAPIDataManager.h"
7
+
8
+ @implementation VIPERAPIDataManager
9
+
10
+ @end
@@ -0,0 +1,12 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+ #import "VIPERProtocols.h"
8
+
9
+
10
+ @interface VIPERLocalDataManager : NSObject <VIPERLocalDataManagerInputProtocol>
11
+
12
+ @end
@@ -0,0 +1,10 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import "VIPERLocalDataManager.h"
7
+
8
+ @implementation VIPERLocalDataManager
9
+
10
+ @end
@@ -0,0 +1,16 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+ #import "VIPERProtocols.h"
8
+
9
+
10
+ @interface VIPERInteractor : NSObject <VIPERInteractorInputProtocol>
11
+
12
+ @property (nonatomic, weak) id <VIPERInteractorOutputProtocol> presenter;
13
+ @property (nonatomic, strong) id <VIPERAPIDataManagerInputProtocol> APIDataManager;
14
+ @property (nonatomic, strong) id <VIPERLocalDataManagerInputProtocol> localDataManager;
15
+
16
+ @end
@@ -0,0 +1,10 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import "VIPERInteractor.h"
7
+
8
+ @implementation VIPERInteractor
9
+
10
+ @end
@@ -0,0 +1,10 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+
8
+ @interface VIPERItem : NSObject
9
+
10
+ @end
@@ -0,0 +1,10 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import "VIPERItem.h"
7
+
8
+ @implementation VIPERItem
9
+
10
+ @end
@@ -0,0 +1,17 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+ #import "VIPERProtocols.h"
8
+
9
+ @class VIPERWireFrame;
10
+
11
+ @interface VIPERPresenter : NSObject <VIPERPresenterProtocol, VIPERInteractorOutputProtocol>
12
+
13
+ @property (nonatomic, weak) id <VIPERViewProtocol> view;
14
+ @property (nonatomic, strong) id <VIPERInteractorInputProtocol> interactor;
15
+ @property (nonatomic, strong) id <VIPERWireFrameProtocol> wireFrame;
16
+
17
+ @end
@@ -0,0 +1,11 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import "VIPERPresenter.h"
7
+ #import "VIPERWireframe.h"
8
+
9
+ @implementation VIPERPresenter
10
+
11
+ @end
@@ -0,0 +1,80 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+ #import <UIKit/UIKit.h>
8
+
9
+ @protocol VIPERInteractorOutputProtocol;
10
+ @protocol VIPERInteractorInputProtocol;
11
+ @protocol VIPERViewProtocol;
12
+ @protocol VIPERPresenterProtocol;
13
+ @protocol VIPERLocalDataManagerInputProtocol;
14
+ @protocol VIPERAPIDataManagerInputProtocol;
15
+
16
+
17
+ @class VIPERWireFrame;
18
+
19
+ @protocol VIPERViewProtocol
20
+ @required
21
+ @property (nonatomic, strong) id <VIPERPresenterProtocol> presenter;
22
+ /**
23
+ * Add here your methods for communication PRESENTER -> VIEWCONTROLLER
24
+ */
25
+ @end
26
+
27
+ @protocol VIPERWireFrameProtocol
28
+ @required
29
+ + (void)presentVIPERModuleFrom:(id)fromView;
30
+ /**
31
+ * Add here your methods for communication PRESENTER -> WIREFRAME
32
+ */
33
+ @end
34
+
35
+ @protocol VIPERPresenterProtocol
36
+ @required
37
+ @property (nonatomic, weak) id <VIPERViewProtocol> view;
38
+ @property (nonatomic, strong) id <VIPERInteractorInputProtocol> interactor;
39
+ @property (nonatomic, strong) id <VIPERWireFrameProtocol> wireFrame;
40
+ /**
41
+ * Add here your methods for communication VIEWCONTROLLER -> PRESENTER
42
+ */
43
+ @end
44
+
45
+ @protocol VIPERInteractorOutputProtocol
46
+ /**
47
+ * Add here your methods for communication INTERACTOR -> PRESENTER
48
+ */
49
+ @end
50
+
51
+ @protocol VIPERInteractorInputProtocol
52
+ @required
53
+ @property (nonatomic, weak) id <VIPERInteractorOutputProtocol> presenter;
54
+ @property (nonatomic, strong) id <VIPERAPIDataManagerInputProtocol> APIDataManager;
55
+ @property (nonatomic, strong) id <VIPERLocalDataManagerInputProtocol> localDataManager;
56
+ /**
57
+ * Add here your methods for communication PRESENTER -> INTERACTOR
58
+ */
59
+ @end
60
+
61
+
62
+ @protocol VIPERDataManagerInputProtocol
63
+ /**
64
+ * Add here your methods for communication INTERACTOR -> DATAMANAGER
65
+ */
66
+ @end
67
+
68
+ @protocol VIPERAPIDataManagerInputProtocol <VIPERDataManagerInputProtocol>
69
+ /**
70
+ * Add here your methods for communication INTERACTOR -> APIDATAMANAGER
71
+ */
72
+ @end
73
+
74
+ @protocol VIPERLocalDataManagerInputProtocol <VIPERDataManagerInputProtocol>
75
+ /**
76
+ * Add here your methods for communication INTERACTOR -> LOCLDATAMANAGER
77
+ */
78
+ @end
79
+
80
+
@@ -0,0 +1,13 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import <UIKit/UIKit.h>
7
+ #import "VIPERProtocols.h"
8
+
9
+ @interface VIPERView : UIViewController <VIPERViewProtocol>
10
+
11
+ @property (nonatomic, strong) id <VIPERPresenterProtocol> presenter;
12
+
13
+ @end
@@ -0,0 +1,32 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import "VIPERView.h"
7
+
8
+ @implementation VIPERView
9
+
10
+ #pragma mark - ViewController Lifecycle
11
+
12
+ - (void)viewDidLoad
13
+ {
14
+ [super viewDidLoad];
15
+ }
16
+
17
+ - (void)viewDidDisappear:(BOOL)animated
18
+ {
19
+ [super viewDidDisappear:animated];
20
+ }
21
+
22
+ - (void)viewWillAppear:(BOOL)animated
23
+ {
24
+ [super viewWillAppear:animated];
25
+ }
26
+
27
+ - (void)viewWillDisappear:(BOOL)animated
28
+ {
29
+ [super viewWillDisappear:animated];
30
+ }
31
+
32
+ @end
@@ -0,0 +1,18 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+ #import "VIPERProtocols.h"
8
+ #import "VIPERView.h"
9
+ #import "VIPERLocalDataManager.h"
10
+ #import "VIPERAPIDataManager.h"
11
+ #import "VIPERInteractor.h"
12
+ #import "VIPERPresenter.h"
13
+ #import "VIPERWireframe.h"
14
+ #import <UIKit/UIKit.h>
15
+
16
+ @interface VIPERWireFrame : NSObject <VIPERWireFrameProtocol>
17
+
18
+ @end
@@ -0,0 +1,32 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ #import "VIPERWireFrame.h"
7
+
8
+ @implementation VIPERWireFrame
9
+
10
+ + (void)presentVIPERModuleFrom:(UIViewController*)fromViewController
11
+ {
12
+ // Generating module components
13
+ id <VIPERViewProtocol> view = [[VIPERView alloc] init];
14
+ id <VIPERPresenterProtocol, VIPERInteractorOutputProtocol> presenter = [VIPERPresenter new];
15
+ id <VIPERInteractorInputProtocol> interactor = [VIPERInteractor new];
16
+ id <VIPERAPIDataManagerInputProtocol> APIDataManager = [VIPERAPIDataManager new];
17
+ id <VIPERLocalDataManagerInputProtocol> localDataManager = [VIPERLocalDataManager new];
18
+ id <VIPERWireFrameProtocol> wireFrame= [VIPERWireFrame new];
19
+
20
+ // Connecting
21
+ view.presenter = presenter;
22
+ presenter.view = view;
23
+ presenter.wireFrame = wireFrame;
24
+ presenter.interactor = interactor;
25
+ interactor.presenter = presenter;
26
+ interactor.APIDataManager = APIDataManager;
27
+ interactor.localDataManager = localDataManager;
28
+
29
+ //TOODO - New view controller presentation (present, push, pop, .. )
30
+ }
31
+
32
+ @end
@@ -0,0 +1,11 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ import Foundation
7
+
8
+ class VIPERAPIDataManager: VIPERAPIDataManagerInputProtocol
9
+ {
10
+ init() {}
11
+ }
@@ -0,0 +1,11 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ import Foundation
7
+
8
+ class VIPERLocalDataManager: VIPERLocalDataManagerInputProtocol
9
+ {
10
+ init() {}
11
+ }
@@ -0,0 +1,15 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ import Foundation
7
+
8
+ class VIPERInteractor: VIPERInteractorInputProtocol
9
+ {
10
+ weak var presenter: VIPERInteractorOutputProtocol?
11
+ var APIDataManager: VIPERAPIDataManagerInputProtocol?
12
+ var localDatamanager: VIPERLocalDataManagerInputProtocol?
13
+
14
+ init() {}
15
+ }
@@ -0,0 +1,13 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ import Foundation
7
+
8
+ struct VIPERItem
9
+ {
10
+ /**
11
+ * Attributes here
12
+ */
13
+ }
@@ -0,0 +1,15 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ import Foundation
7
+
8
+ class VIPERPresenter: VIPERPresenterProtocol, VIPERInteractorOutputProtocol
9
+ {
10
+ weak var view: VIPERViewProtocol?
11
+ var interactor: VIPERInteractorInputProtocol?
12
+ var wireFrame: VIPERWireFrameProtocol?
13
+
14
+ init() {}
15
+ }
@@ -0,0 +1,70 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ import Foundation
7
+
8
+ protocol VIPERViewProtocol: class
9
+ {
10
+ var presenter: VIPERPresenterProtocol? { get set }
11
+ /**
12
+ * Add here your methods for communication PRESENTER -> VIEW
13
+ */
14
+ }
15
+
16
+ protocol VIPERWireFrameProtocol: class
17
+ {
18
+ class func presentVIPERModule(fromView view: AnyObject)
19
+ /**
20
+ * Add here your methods for communication PRESENTER -> WIREFRAME
21
+ */
22
+ }
23
+
24
+ protocol VIPERPresenterProtocol: class
25
+ {
26
+ var view: VIPERViewProtocol? { get set }
27
+ var interactor: VIPERInteractorInputProtocol? { get set }
28
+ var wireFrame: VIPERWireFrameProtocol? { get set }
29
+ /**
30
+ * Add here your methods for communication VIEW -> PRESENTER
31
+ */
32
+ }
33
+
34
+ protocol VIPERInteractorOutputProtocol: class
35
+ {
36
+ /**
37
+ * Add here your methods for communication INTERACTOR -> PRESENTER
38
+ */
39
+ }
40
+
41
+ protocol VIPERInteractorInputProtocol: class
42
+ {
43
+ var presenter: VIPERInteractorOutputProtocol? { get set }
44
+ var APIDataManager: VIPERAPIDataManagerInputProtocol? { get set }
45
+ var localDatamanager: VIPERLocalDataManagerInputProtocol? { get set }
46
+ /**
47
+ * Add here your methods for communication PRESENTER -> INTERACTOR
48
+ */
49
+ }
50
+
51
+ protocol VIPERDataManagerInputProtocol: class
52
+ {
53
+ /**
54
+ * Add here your methods for communication INTERACTOR -> DATAMANAGER
55
+ */
56
+ }
57
+
58
+ protocol VIPERAPIDataManagerInputProtocol: class
59
+ {
60
+ /**
61
+ * Add here your methods for communication INTERACTOR -> APIDATAMANAGER
62
+ */
63
+ }
64
+
65
+ protocol VIPERLocalDataManagerInputProtocol: class
66
+ {
67
+ /**
68
+ * Add here your methods for communication INTERACTOR -> LOCALDATAMANAGER
69
+ */
70
+ }
@@ -0,0 +1,12 @@
1
+ //
2
+ // Created by AUTHOR
3
+ // Copyright (c) YEAR AUTHOR. All rights reserved.
4
+ //
5
+
6
+ import Foundation
7
+ import UIKit
8
+
9
+ class VIPERView: UIViewController, VIPERViewProtocol
10
+ {
11
+ var presenter: VIPERPresenterProtocol?
12
+ }