vipergen-xctestable 0.2.9
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 +7 -0
- data/LICENSE +21 -0
- data/README.md +157 -0
- data/bin/vipergen +9 -0
- data/lib/templates/default/objc/DataManager/API/VIPERAPIDataManager.h +12 -0
- data/lib/templates/default/objc/DataManager/API/VIPERAPIDataManager.m +10 -0
- data/lib/templates/default/objc/DataManager/Local/VIPERLocalDataManager.h +12 -0
- data/lib/templates/default/objc/DataManager/Local/VIPERLocalDataManager.m +10 -0
- data/lib/templates/default/objc/Interactor/VIPERInteractor.h +16 -0
- data/lib/templates/default/objc/Interactor/VIPERInteractor.m +10 -0
- data/lib/templates/default/objc/Interactor/VIPERItem.h +10 -0
- data/lib/templates/default/objc/Interactor/VIPERItem.m +10 -0
- data/lib/templates/default/objc/Presenter/VIPERPresenter.h +17 -0
- data/lib/templates/default/objc/Presenter/VIPERPresenter.m +11 -0
- data/lib/templates/default/objc/Protocols/VIPERProtocols.h +80 -0
- data/lib/templates/default/objc/View/VIPERView.h +13 -0
- data/lib/templates/default/objc/View/VIPERView.m +32 -0
- data/lib/templates/default/objc/WireFrame/VIPERWireFrame.h +18 -0
- data/lib/templates/default/objc/WireFrame/VIPERWireFrame.m +32 -0
- data/lib/templates/default/swift/DataManager/API/VIPERAPIDataManager.swift +11 -0
- data/lib/templates/default/swift/DataManager/Local/VIPERLocalDataManager.swift +11 -0
- data/lib/templates/default/swift/Interactor/VIPERInteractor.swift +15 -0
- data/lib/templates/default/swift/Interactor/VIPERItem.swift +13 -0
- data/lib/templates/default/swift/Presenter/VIPERPresenter.swift +15 -0
- data/lib/templates/default/swift/Protocols/VIPERProtocols.swift +70 -0
- data/lib/templates/default/swift/View/VIPERView.swift +12 -0
- data/lib/templates/default/swift/WireFrame/VIPERWireFrame.swift +29 -0
- data/lib/templates/default/viperspec.yml +4 -0
- data/lib/templates/testable/objc/DataManager/VIPERDataManager.h +15 -0
- data/lib/templates/testable/objc/DataManager/VIPERDataManager.m +11 -0
- data/lib/templates/testable/objc/Interactor/VIPERInteractor.h +16 -0
- data/lib/templates/testable/objc/Interactor/VIPERInteractor.m +10 -0
- data/lib/templates/testable/objc/Interactor/VIPERInteractorSpec.m +31 -0
- data/lib/templates/testable/objc/Presenter/VIPERPresenter.h +18 -0
- data/lib/templates/testable/objc/Presenter/VIPERPresenter.m +11 -0
- data/lib/templates/testable/objc/Presenter/VIPERPresenterSpec.m +31 -0
- data/lib/templates/testable/objc/Protocols/VIPERProtocols.h +64 -0
- data/lib/templates/testable/objc/ViewController/VIPERViewController.h +13 -0
- data/lib/templates/testable/objc/ViewController/VIPERViewController.m +32 -0
- data/lib/templates/testable/objc/ViewController/VIPERViewControllerSpec.m +31 -0
- data/lib/templates/testable/objc/WireFrame/VIPERWireFrame.h +19 -0
- data/lib/templates/testable/objc/WireFrame/VIPERWireFrame.m +31 -0
- data/lib/templates/testable/swift/DataManager/API/VIPERAPIDataManager.swift +11 -0
- data/lib/templates/testable/swift/DataManager/Local/VIPERLocalDataManager.swift +11 -0
- data/lib/templates/testable/swift/Interactor/VIPERInteractor.swift +15 -0
- data/lib/templates/testable/swift/Interactor/VIPERInteractorSpec.swift +22 -0
- data/lib/templates/testable/swift/Presenter/VIPERPresenter.swift +15 -0
- data/lib/templates/testable/swift/Presenter/VIPERPresenterSpec.swift +22 -0
- data/lib/templates/testable/swift/Protocols/VIPERProtocols.swift +70 -0
- data/lib/templates/testable/swift/View/VIPERView.swift +12 -0
- data/lib/templates/testable/swift/View/VIPERViewSpec.swift +22 -0
- data/lib/templates/testable/swift/WireFrame/VIPERWireFrame.swift +31 -0
- data/lib/templates/testable/viperspec.yml +4 -0
- data/lib/templates/xctestable/objc/DataManager/VIPERDataManager.h +15 -0
- data/lib/templates/xctestable/objc/DataManager/VIPERDataManager.m +11 -0
- data/lib/templates/xctestable/objc/Interactor/VIPERInteractor.h +16 -0
- data/lib/templates/xctestable/objc/Interactor/VIPERInteractor.m +10 -0
- data/lib/templates/xctestable/objc/Interactor/VIPERInteractorSpec.m +31 -0
- data/lib/templates/xctestable/objc/Presenter/VIPERPresenter.h +18 -0
- data/lib/templates/xctestable/objc/Presenter/VIPERPresenter.m +11 -0
- data/lib/templates/xctestable/objc/Presenter/VIPERPresenterSpec.m +31 -0
- data/lib/templates/xctestable/objc/Protocols/VIPERProtocols.h +64 -0
- data/lib/templates/xctestable/objc/ViewController/VIPERViewController.h +13 -0
- data/lib/templates/xctestable/objc/ViewController/VIPERViewController.m +32 -0
- data/lib/templates/xctestable/objc/ViewController/VIPERViewControllerSpec.m +31 -0
- data/lib/templates/xctestable/objc/WireFrame/VIPERWireFrame.h +19 -0
- data/lib/templates/xctestable/objc/WireFrame/VIPERWireFrame.m +31 -0
- data/lib/templates/xctestable/swift/DataManager/API/VIPERAPIDataManager.swift +11 -0
- data/lib/templates/xctestable/swift/DataManager/Local/VIPERLocalDataManager.swift +11 -0
- data/lib/templates/xctestable/swift/Interactor/VIPERInteractor.swift +15 -0
- data/lib/templates/xctestable/swift/Interactor/VIPERInteractorTests.swift +29 -0
- data/lib/templates/xctestable/swift/Presenter/VIPERPresenter.swift +15 -0
- data/lib/templates/xctestable/swift/Presenter/VIPERPresenterTests.swift +29 -0
- data/lib/templates/xctestable/swift/Protocols/VIPERProtocols.swift +70 -0
- data/lib/templates/xctestable/swift/View/VIPERView.swift +12 -0
- data/lib/templates/xctestable/swift/View/VIPERViewTests.swift +29 -0
- data/lib/templates/xctestable/swift/WireFrame/VIPERWireFrame.swift +32 -0
- data/lib/templates/xctestable/viperspec.yml +4 -0
- data/lib/vipergen/dirutils.rb +17 -0
- data/lib/vipergen/filemanager.rb +51 -0
- data/lib/vipergen/generator.rb +66 -0
- data/lib/vipergen/templatemanager.rb +53 -0
- data/lib/vipergen/version.rb +4 -0
- data/lib/vipergen/viperthor.rb +21 -0
- data/lib/vipergen.rb +6 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/vipergen/vipergen_spec.rb +133 -0
- metadata +207 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
//
|
2
|
+
// Created by AUTHOR.
|
3
|
+
// Copyright (c) YEAR AUTHOR. All rights reserved.
|
4
|
+
//
|
5
|
+
|
6
|
+
//#import "Spec.h" - this header should have imports of Specta, Expecta, OCMokito, OCHamrest
|
7
|
+
#import "VIPERInteractor.h"
|
8
|
+
|
9
|
+
|
10
|
+
SpecBegin(VIPERInteractor)
|
11
|
+
|
12
|
+
describe(@"VIPERInteractor",^{
|
13
|
+
__block VIPERInteractor *sut;
|
14
|
+
|
15
|
+
beforeEach(^{
|
16
|
+
|
17
|
+
});
|
18
|
+
|
19
|
+
afterEach(^{
|
20
|
+
sut = nil;
|
21
|
+
});
|
22
|
+
|
23
|
+
describe(@"VIPERInteractorComponent",{
|
24
|
+
it(@"VIPERInteractorComponent should pass test",{
|
25
|
+
|
26
|
+
});
|
27
|
+
});
|
28
|
+
|
29
|
+
});
|
30
|
+
|
31
|
+
SpecEnd
|
@@ -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
|
+
|
9
|
+
@class VIPERWireFrame;
|
10
|
+
|
11
|
+
@interface VIPERPresenter : NSObject <VIPERPresenterProtocol, VIPERInteractorOutputProtocol>
|
12
|
+
|
13
|
+
// Properties
|
14
|
+
@property (nonatomic, weak) id <VIPERViewProtocol> view;
|
15
|
+
@property (nonatomic, strong) id <VIPERInteractorInputProtocol> interactor;
|
16
|
+
@property (nonatomic, strong) VIPERWireFrame *wireFrame;
|
17
|
+
|
18
|
+
@end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
//
|
2
|
+
// Created by AUTHOR.
|
3
|
+
// Copyright (c) YEAR AUTHOR. All rights reserved.
|
4
|
+
//
|
5
|
+
|
6
|
+
//#import "Spec.h" - this header should have imports of Specta, Expecta, OCMokito, OCHamrest
|
7
|
+
#import "VIPERPresenter.h"
|
8
|
+
|
9
|
+
|
10
|
+
SpecBegin(VIPERPresenter)
|
11
|
+
|
12
|
+
describe(@"VIPERPresenter",^{
|
13
|
+
__block VIPERPresenter *sut;
|
14
|
+
|
15
|
+
beforeEach(^{
|
16
|
+
|
17
|
+
});
|
18
|
+
|
19
|
+
afterEach(^{
|
20
|
+
sut = nil;
|
21
|
+
});
|
22
|
+
|
23
|
+
describe(@"VIPERPresenterComponent",{
|
24
|
+
it(@"VIPERPresenterComponent should pass test",{
|
25
|
+
|
26
|
+
});
|
27
|
+
});
|
28
|
+
|
29
|
+
});
|
30
|
+
|
31
|
+
SpecEnd
|
@@ -0,0 +1,64 @@
|
|
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 VIPERDataManagerOutputProtocol;
|
10
|
+
@protocol VIPERInteractorOutputProtocol;
|
11
|
+
@protocol VIPERInteractorInputProtocol;
|
12
|
+
@protocol VIPERViewProtocol;
|
13
|
+
@protocol VIPERPresenterProtocol;
|
14
|
+
@protocol VIPERDataManagerInputProtocol;
|
15
|
+
@class VIPERWireFrame;
|
16
|
+
|
17
|
+
typedef void (^CompletionBlock)(NSError **error);
|
18
|
+
|
19
|
+
@protocol VIPERViewProtocol
|
20
|
+
@required
|
21
|
+
@property (nonatomic, strong) id <VIPERPresenterProtocol> presenter;
|
22
|
+
/**
|
23
|
+
* Add here your methods for communication VIEWCONTROLLER -> PRESENTER
|
24
|
+
*/
|
25
|
+
@end
|
26
|
+
|
27
|
+
@protocol VIPERPresenterProtocol
|
28
|
+
@required
|
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
|
+
*/
|
35
|
+
@end
|
36
|
+
|
37
|
+
@protocol VIPERInteractorOutputProtocol
|
38
|
+
/**
|
39
|
+
* Add here your methods for communication INTERACTOR -> PRESENTER
|
40
|
+
*/
|
41
|
+
@end
|
42
|
+
|
43
|
+
@protocol VIPERInteractorInputProtocol
|
44
|
+
@required
|
45
|
+
@property (nonatomic, weak) id <VIPERInteractorOutputProtocol> presenter;
|
46
|
+
/**
|
47
|
+
* Add here your methods for communication PRESENTER -> INTERACTOR
|
48
|
+
*/
|
49
|
+
@end
|
50
|
+
|
51
|
+
|
52
|
+
@protocol VIPERDataManagerInputProtocol
|
53
|
+
@property (nonatomic, weak) id <VIPERDataManagerOutputProtocol> interactor;
|
54
|
+
/**
|
55
|
+
* Add here your methods for communication INTERACTOR -> DATAMANAGER
|
56
|
+
*/
|
57
|
+
@end
|
58
|
+
|
59
|
+
@protocol VIPERDataManagerOutputProtocol
|
60
|
+
@property (nonatomic, strong) id <VIPERDataManagerInputProtocol> dataManager;
|
61
|
+
/**
|
62
|
+
* Add here your methods for communication DATAMANAGER -> INTERACTOR
|
63
|
+
*/
|
64
|
+
@end
|
@@ -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 VIPERViewController : 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 "VIPERViewController.h"
|
7
|
+
|
8
|
+
@implementation VIPERViewController
|
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,31 @@
|
|
1
|
+
//
|
2
|
+
// Created by AUTHOR.
|
3
|
+
// Copyright (c) YEAR AUTHOR. All rights reserved.
|
4
|
+
//
|
5
|
+
|
6
|
+
//#import "Spec.h" - this header should have imports of Specta, Expecta, OCMokito, OCHamrest
|
7
|
+
#import "VIPERViewController.h"
|
8
|
+
|
9
|
+
|
10
|
+
SpecBegin(VIPERViewController)
|
11
|
+
|
12
|
+
describe(@"VIPERViewController",^{
|
13
|
+
__block VIPERViewController *sut;
|
14
|
+
|
15
|
+
beforeEach(^{
|
16
|
+
|
17
|
+
});
|
18
|
+
|
19
|
+
afterEach(^{
|
20
|
+
sut = nil;
|
21
|
+
});
|
22
|
+
|
23
|
+
describe(@"VIPERViewControllerComponent",{
|
24
|
+
it(@"VIPERViewControllerComponent should pass test",{
|
25
|
+
|
26
|
+
});
|
27
|
+
});
|
28
|
+
|
29
|
+
});
|
30
|
+
|
31
|
+
SpecEnd
|
@@ -0,0 +1,19 @@
|
|
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 "VIPERViewController.h"
|
9
|
+
#import "VIPERDataManager.h"
|
10
|
+
#import "VIPERInteractor.h"
|
11
|
+
#import "VIPERPresenter.h"
|
12
|
+
#import "VIPERWireframe.h"
|
13
|
+
#import <UIKit/UIKit.h>
|
14
|
+
|
15
|
+
@interface VIPERWireFrame : NSObject
|
16
|
+
|
17
|
+
+ (void)presentVIPERModuleFrom:(id)fromView;
|
18
|
+
|
19
|
+
@end
|
@@ -0,0 +1,31 @@
|
|
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
|
+
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
|
+
presenter.interactor = interactor;
|
24
|
+
interactor.presenter = presenter;
|
25
|
+
interactor.dataManager = dataManager;
|
26
|
+
dataManager.interactor = interactor;
|
27
|
+
|
28
|
+
//TOODO - New view controller presentation (present, push, pop, .. )
|
29
|
+
}
|
30
|
+
|
31
|
+
@end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
//
|
2
|
+
// Created by AUTHOR.
|
3
|
+
// Copyright (c) YEAR AUTHOR. All rights reserved.
|
4
|
+
//
|
5
|
+
|
6
|
+
import Foundation
|
7
|
+
|
8
|
+
final class VIPERInteractor: VIPERInteractorInputProtocol
|
9
|
+
{
|
10
|
+
weak var presenter: VIPERInteractorOutputProtocol?
|
11
|
+
var APIDataManager: VIPERAPIDataManagerInputProtocol?
|
12
|
+
var localDataManager: VIPERLocalDataManagerInputProtocol?
|
13
|
+
|
14
|
+
init() {}
|
15
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
//
|
2
|
+
// Created by AUTHOR.
|
3
|
+
// Copyright (c) YEAR AUTHOR. All rights reserved.
|
4
|
+
//
|
5
|
+
|
6
|
+
import XCTest
|
7
|
+
|
8
|
+
@testable import SWIFT_MODULE
|
9
|
+
|
10
|
+
class VIPERInteractorTests: XCTestCase{
|
11
|
+
|
12
|
+
class Mock{
|
13
|
+
|
14
|
+
}
|
15
|
+
|
16
|
+
override func setUp() {
|
17
|
+
super.setUp()
|
18
|
+
// Put setup code here. This method is called before the invocation of each test method in the class.
|
19
|
+
}
|
20
|
+
|
21
|
+
override func tearDown() {
|
22
|
+
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
23
|
+
super.tearDown()
|
24
|
+
}
|
25
|
+
|
26
|
+
func testExample() {
|
27
|
+
// Put Arrange-Act-Assert code here
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
//
|
2
|
+
// Created by AUTHOR.
|
3
|
+
// Copyright (c) YEAR AUTHOR. All rights reserved.
|
4
|
+
//
|
5
|
+
|
6
|
+
import Foundation
|
7
|
+
|
8
|
+
final 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,29 @@
|
|
1
|
+
//
|
2
|
+
// Created by AUTHOR.
|
3
|
+
// Copyright (c) YEAR AUTHOR. All rights reserved.
|
4
|
+
//
|
5
|
+
|
6
|
+
import XCTest
|
7
|
+
|
8
|
+
@testable import SWIFT_MODULE
|
9
|
+
|
10
|
+
class VIPERPresenterTests: XCTestCase{
|
11
|
+
|
12
|
+
class Mock{
|
13
|
+
|
14
|
+
}
|
15
|
+
|
16
|
+
override func setUp() {
|
17
|
+
super.setUp()
|
18
|
+
// Put setup code here. This method is called before the invocation of each test method in the class.
|
19
|
+
}
|
20
|
+
|
21
|
+
override func tearDown() {
|
22
|
+
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
23
|
+
super.tearDown()
|
24
|
+
}
|
25
|
+
|
26
|
+
func testExample() {
|
27
|
+
// Put Arrange-Act-Assert code here
|
28
|
+
}
|
29
|
+
}
|
@@ -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
|
+
static func setupVIPERModule(object: AnyObject) -> UIViewController
|
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,29 @@
|
|
1
|
+
//
|
2
|
+
// Created by AUTHOR.
|
3
|
+
// Copyright (c) YEAR AUTHOR. All rights reserved.
|
4
|
+
//
|
5
|
+
|
6
|
+
import XCTest
|
7
|
+
|
8
|
+
@testable import SWIFT_MODULE
|
9
|
+
|
10
|
+
class VIPERViewTests: XCTestCase{
|
11
|
+
|
12
|
+
class Mock{
|
13
|
+
|
14
|
+
}
|
15
|
+
|
16
|
+
override func setUp() {
|
17
|
+
super.setUp()
|
18
|
+
// Put setup code here. This method is called before the invocation of each test method in the class.
|
19
|
+
}
|
20
|
+
|
21
|
+
override func tearDown() {
|
22
|
+
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
23
|
+
super.tearDown()
|
24
|
+
}
|
25
|
+
|
26
|
+
func testExample() {
|
27
|
+
// Put Arrange-Act-Assert code here
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
//
|
2
|
+
// Created by AUTHOR.
|
3
|
+
// Copyright (c) YEAR AUTHOR. All rights reserved.
|
4
|
+
//
|
5
|
+
|
6
|
+
import Foundation
|
7
|
+
import UIKit
|
8
|
+
|
9
|
+
final class VIPERWireFrame: VIPERWireFrameProtocol
|
10
|
+
{
|
11
|
+
class func setupVIPERModule(object: AnyObject) -> UIViewController
|
12
|
+
{
|
13
|
+
// Generating module components
|
14
|
+
let view: VIPERViewProtocol = VIPERView()
|
15
|
+
let presenter: VIPERPresenterProtocol & VIPERInteractorOutputProtocol = VIPERPresenter()
|
16
|
+
let interactor: VIPERInteractorInputProtocol = VIPERInteractor()
|
17
|
+
let APIDataManager: VIPERAPIDataManagerInputProtocol = VIPERAPIDataManager()
|
18
|
+
let localDataManager: VIPERLocalDataManagerInputProtocol = VIPERLocalDataManager()
|
19
|
+
let wireFrame: VIPERWireFrameProtocol = VIPERWireFrame()
|
20
|
+
|
21
|
+
// Connecting
|
22
|
+
view.presenter = presenter
|
23
|
+
presenter.view = view
|
24
|
+
presenter.wireFrame = wireFrame
|
25
|
+
presenter.interactor = interactor
|
26
|
+
interactor.presenter = presenter
|
27
|
+
interactor.APIDataManager = APIDataManager
|
28
|
+
interactor.localDataManager = localDataManager
|
29
|
+
|
30
|
+
return UINavigationController(rootViewController: view as! UIViewController)
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Vipergen
|
2
|
+
class DirUtils
|
3
|
+
# Return a directory with the project libraries.
|
4
|
+
def self.gem_libdir
|
5
|
+
t = ["#{File.dirname(File.expand_path($0))}/../lib/#{Vipergen::NAME}",
|
6
|
+
"#{Gem.dir}/gems/#{Vipergen::NAME}-#{Vipergen::VERSION}/lib/#{Vipergen::NAME}"]
|
7
|
+
t.each {|i| return i if File.readable?(i) }
|
8
|
+
raise "both paths are invalid: #{t}"
|
9
|
+
end
|
10
|
+
|
11
|
+
# Returns the directories inside a given one
|
12
|
+
def self.directories_in(directory)
|
13
|
+
expanded_dir = File.expand_path(directory)
|
14
|
+
return Dir.glob(File.join(expanded_dir,'*')).select {|f| File.directory? f}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Vipergen
|
2
|
+
# File manager class
|
3
|
+
class FileManager
|
4
|
+
|
5
|
+
# Returns if the template is valid by the VIPER generator
|
6
|
+
def self.is_template_valid(template)
|
7
|
+
return Vipergen::TemplateManager.templates.include? template
|
8
|
+
end
|
9
|
+
|
10
|
+
# Returns if the language is valid by the VIPER generator
|
11
|
+
def self.is_language_valid(language)
|
12
|
+
return (Vipergen::Generator::LANGUAGES).include? language
|
13
|
+
end
|
14
|
+
|
15
|
+
# Return the path if valid template and language
|
16
|
+
# @return String with valid path
|
17
|
+
def self.path_from(template, language)
|
18
|
+
return nil if !is_language_valid(language) || !is_template_valid(template)
|
19
|
+
return File.join(Vipergen::TemplateManager.templates_dir, template, language)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns an array with files in a given path
|
23
|
+
# @return Array with the files in a given path
|
24
|
+
def self.files_in_path(path)
|
25
|
+
return Dir[File.join("#{path}","/**/*")].select {|f| File.file?(f)}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Returns the destination viper path
|
29
|
+
# @return Destination root path
|
30
|
+
def self.destination_viper_path(path, name)
|
31
|
+
expand_path = File.expand_path(path)
|
32
|
+
return File.join(expand_path,name)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Copy a system item to another place
|
36
|
+
def self.copy(from, to)
|
37
|
+
to_expand_path = File.expand_path(to)
|
38
|
+
from_expand_path = File.expand_path(from)
|
39
|
+
FileUtils.mkdir_p (to_expand_path)
|
40
|
+
FileUtils.copy_entry(from_expand_path, to_expand_path)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Move a system item to another place
|
44
|
+
def self.move(from, to)
|
45
|
+
to_expand_path = File.expand_path(to)
|
46
|
+
from_expand_path = File.expand_path(from)
|
47
|
+
FileUtils.move(from_expand_path, to_expand_path)
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|