mvcgen 0.1.2
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 +115 -0
 - data/bin/mvcgen +9 -0
 - data/lib/mvcgen.rb +6 -0
 - data/lib/mvcgen/dirutils.rb +17 -0
 - data/lib/mvcgen/filemanager.rb +51 -0
 - data/lib/mvcgen/generator.rb +58 -0
 - data/lib/mvcgen/mvcthor.rb +19 -0
 - data/lib/mvcgen/templatemanager.rb +53 -0
 - data/lib/mvcgen/version.rb +4 -0
 - data/lib/templates/default/mvcspec.yml +4 -0
 - data/lib/templates/default/objc/DataManager/VIPERDataManager.h +15 -0
 - data/lib/templates/default/objc/DataManager/VIPERDataManager.m +11 -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/Presenter/VIPERPresenter.h +18 -0
 - data/lib/templates/default/objc/Presenter/VIPERPresenter.m +11 -0
 - data/lib/templates/default/objc/Protocols/VIPERProtocols.h +64 -0
 - data/lib/templates/default/objc/ViewController/VIPERViewController.h +13 -0
 - data/lib/templates/default/objc/ViewController/VIPERViewController.m +32 -0
 - data/lib/templates/default/objc/WireFrame/VIPERWireFrame.h +19 -0
 - data/lib/templates/default/objc/WireFrame/VIPERWireFrame.m +31 -0
 - data/lib/templates/default/swift/Config/Config.plist +58 -0
 - data/lib/templates/default/swift/Config/Config.swift +50 -0
 - data/lib/templates/default/swift/Extensions/Buttons.swift +110 -0
 - data/lib/templates/default/swift/Extensions/ColorHex.swift +32 -0
 - data/lib/templates/default/swift/Helper/APIHelper.swift +98 -0
 - data/lib/templates/default/swift/Helper/APIManager.swift +217 -0
 - data/lib/templates/default/swift/Helper/APIRequestBody.swift +81 -0
 - data/lib/templates/default/swift/Helper/AWSManager.swift +29 -0
 - data/lib/templates/default/swift/Helper/FilesManager.swift +97 -0
 - data/lib/templates/default/swift/Helper/S3Manager.swift +113 -0
 - data/lib/templates/default/swift/Helper/Utils.swift +69 -0
 - data/lib/templates/default/swift/Models/Managers/UserManager.swift +56 -0
 - data/lib/templates/default/swift/Models/Responses/BaseResponse.swift +75 -0
 - data/lib/templates/default/swift/Models/Responses/UserResponse.swift +30 -0
 - data/lib/templates/default/swift/Models/Responses/UserSingupResponse.swift +27 -0
 - data/lib/templates/default/swift/Models/User.swift +92 -0
 - data/spec/mvcgen/mvcgen_spec.rb +131 -0
 - data/spec/spec_helper.rb +4 -0
 - metadata +159 -0
 
| 
         @@ -0,0 +1,64 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            //
         
     | 
| 
      
 2 
     | 
    
         
            +
            // Created by Pedro Piñera Buendía on 2014.
         
     | 
| 
      
 3 
     | 
    
         
            +
            // Copyright (c) 2014 Redbooth. 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 Pedro Piñera Buendía on 2014.
         
     | 
| 
      
 3 
     | 
    
         
            +
            // Copyright (c) 2014 Redbooth. 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 Pedro Piñera Buendía on 2014.
         
     | 
| 
      
 3 
     | 
    
         
            +
            // Copyright (c) 2014 Redbooth. 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,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            //
         
     | 
| 
      
 2 
     | 
    
         
            +
            // Created by Pedro Piñera Buendía on 2014.
         
     | 
| 
      
 3 
     | 
    
         
            +
            // Copyright (c) 2014 Redbooth. 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 Pedro Piñera Buendía on 2014.
         
     | 
| 
      
 3 
     | 
    
         
            +
            // Copyright (c) 2014 Redbooth. 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,58 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <?xml version="1.0" encoding="UTF-8"?>
         
     | 
| 
      
 2 
     | 
    
         
            +
            <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
         
     | 
| 
      
 3 
     | 
    
         
            +
            <plist version="1.0">
         
     | 
| 
      
 4 
     | 
    
         
            +
            <dict>
         
     | 
| 
      
 5 
     | 
    
         
            +
            	<key>Development</key>
         
     | 
| 
      
 6 
     | 
    
         
            +
            	<dict>
         
     | 
| 
      
 7 
     | 
    
         
            +
            		<key>AWSIdentityPoolId</key>
         
     | 
| 
      
 8 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 9 
     | 
    
         
            +
            		<key>S3BucketName</key>
         
     | 
| 
      
 10 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 11 
     | 
    
         
            +
            		<key>ServicesURL</key>
         
     | 
| 
      
 12 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 13 
     | 
    
         
            +
            		<key>OneSignalAppId</key>
         
     | 
| 
      
 14 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 15 
     | 
    
         
            +
            		<key>ServicesVersion</key>
         
     | 
| 
      
 16 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 17 
     | 
    
         
            +
            	</dict>
         
     | 
| 
      
 18 
     | 
    
         
            +
            	<key>QA</key>
         
     | 
| 
      
 19 
     | 
    
         
            +
            	<dict>
         
     | 
| 
      
 20 
     | 
    
         
            +
            		<key>AWSIdentityPoolId</key>
         
     | 
| 
      
 21 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 22 
     | 
    
         
            +
            		<key>S3BucketName</key>
         
     | 
| 
      
 23 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 24 
     | 
    
         
            +
            		<key>ServicesURL</key>
         
     | 
| 
      
 25 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 26 
     | 
    
         
            +
            		<key>OneSignalAppId</key>
         
     | 
| 
      
 27 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 28 
     | 
    
         
            +
            		<key>ServicesVersion</key>
         
     | 
| 
      
 29 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 30 
     | 
    
         
            +
            	</dict>
         
     | 
| 
      
 31 
     | 
    
         
            +
            	<key>Staging</key>
         
     | 
| 
      
 32 
     | 
    
         
            +
            	<dict>
         
     | 
| 
      
 33 
     | 
    
         
            +
            		<key>AWSIdentityPoolId</key>
         
     | 
| 
      
 34 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 35 
     | 
    
         
            +
            		<key>S3BucketName</key>
         
     | 
| 
      
 36 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 37 
     | 
    
         
            +
            		<key>ServicesURL</key>
         
     | 
| 
      
 38 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 39 
     | 
    
         
            +
            		<key>OneSignalAppId</key>
         
     | 
| 
      
 40 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 41 
     | 
    
         
            +
            		<key>ServicesVersion</key>
         
     | 
| 
      
 42 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 43 
     | 
    
         
            +
            	</dict>
         
     | 
| 
      
 44 
     | 
    
         
            +
            	<key>Production</key>
         
     | 
| 
      
 45 
     | 
    
         
            +
            	<dict>
         
     | 
| 
      
 46 
     | 
    
         
            +
            		<key>AWSIdentityPoolId</key>
         
     | 
| 
      
 47 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 48 
     | 
    
         
            +
            		<key>S3BucketName</key>
         
     | 
| 
      
 49 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 50 
     | 
    
         
            +
            		<key>ServicesURL</key>
         
     | 
| 
      
 51 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 52 
     | 
    
         
            +
            		<key>OneSignalAppId</key>
         
     | 
| 
      
 53 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 54 
     | 
    
         
            +
            		<key>ServicesVersion</key>
         
     | 
| 
      
 55 
     | 
    
         
            +
            		<string></string>
         
     | 
| 
      
 56 
     | 
    
         
            +
            	</dict>
         
     | 
| 
      
 57 
     | 
    
         
            +
            </dict>
         
     | 
| 
      
 58 
     | 
    
         
            +
            </plist>
         
     | 
| 
         @@ -0,0 +1,50 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            //
         
     | 
| 
      
 2 
     | 
    
         
            +
            //  Config.swift
         
     | 
| 
      
 3 
     | 
    
         
            +
            //  MVCGEN
         
     | 
| 
      
 4 
     | 
    
         
            +
            //
         
     | 
| 
      
 5 
     | 
    
         
            +
            //  Created by Daniel Martinez on 23/7/18.
         
     | 
| 
      
 6 
     | 
    
         
            +
            //  Copyright © 2018 DanielMartinez. All rights reserved.
         
     | 
| 
      
 7 
     | 
    
         
            +
            //
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            import UIKit
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            class Config: NSObject {
         
     | 
| 
      
 13 
     | 
    
         
            +
                
         
     | 
| 
      
 14 
     | 
    
         
            +
                // MARK: - Singleton
         
     | 
| 
      
 15 
     | 
    
         
            +
                
         
     | 
| 
      
 16 
     | 
    
         
            +
                static let sharedInstance = Config()
         
     | 
| 
      
 17 
     | 
    
         
            +
                
         
     | 
| 
      
 18 
     | 
    
         
            +
                var config: NSDictionary?
         
     | 
| 
      
 19 
     | 
    
         
            +
                
         
     | 
| 
      
 20 
     | 
    
         
            +
                private override init() {
         
     | 
| 
      
 21 
     | 
    
         
            +
                    
         
     | 
| 
      
 22 
     | 
    
         
            +
                    let currentConfiguration = Bundle.main.object(forInfoDictionaryKey: "Config")!
         
     | 
| 
      
 23 
     | 
    
         
            +
                    
         
     | 
| 
      
 24 
     | 
    
         
            +
                    let path = Bundle.main.path(forResource: "Config", ofType: "plist")!
         
     | 
| 
      
 25 
     | 
    
         
            +
                    
         
     | 
| 
      
 26 
     | 
    
         
            +
                    self.config = NSDictionary(contentsOfFile: path)?.object(forKey: currentConfiguration) as? NSDictionary
         
     | 
| 
      
 27 
     | 
    
         
            +
                }
         
     | 
| 
      
 28 
     | 
    
         
            +
                
         
     | 
| 
      
 29 
     | 
    
         
            +
                func servicesURL() -> String {
         
     | 
| 
      
 30 
     | 
    
         
            +
                    return self.config?.object(forKey: "ServicesURL") as? String ?? ""
         
     | 
| 
      
 31 
     | 
    
         
            +
                }
         
     | 
| 
      
 32 
     | 
    
         
            +
                
         
     | 
| 
      
 33 
     | 
    
         
            +
                func servicesVersion() -> String {
         
     | 
| 
      
 34 
     | 
    
         
            +
                    return self.config?.object(forKey: "ServicesVersion") as? String ?? ""
         
     | 
| 
      
 35 
     | 
    
         
            +
                }
         
     | 
| 
      
 36 
     | 
    
         
            +
                
         
     | 
| 
      
 37 
     | 
    
         
            +
                func oneSignalAppId() -> String {
         
     | 
| 
      
 38 
     | 
    
         
            +
                    return self.config?.object(forKey: "OneSignalAppId") as? String ?? ""
         
     | 
| 
      
 39 
     | 
    
         
            +
                }
         
     | 
| 
      
 40 
     | 
    
         
            +
                
         
     | 
| 
      
 41 
     | 
    
         
            +
                func s3BucketName() -> String {
         
     | 
| 
      
 42 
     | 
    
         
            +
                    return self.config?.object(forKey: "S3BucketName") as? String ?? ""
         
     | 
| 
      
 43 
     | 
    
         
            +
                }
         
     | 
| 
      
 44 
     | 
    
         
            +
                
         
     | 
| 
      
 45 
     | 
    
         
            +
                func awsIdentityPoolId() -> String {
         
     | 
| 
      
 46 
     | 
    
         
            +
                    return self.config?.object(forKey: "AWSIdentityPoolId") as? String ?? ""
         
     | 
| 
      
 47 
     | 
    
         
            +
                }
         
     | 
| 
      
 48 
     | 
    
         
            +
                
         
     | 
| 
      
 49 
     | 
    
         
            +
            }
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,110 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            //
         
     | 
| 
      
 2 
     | 
    
         
            +
            //  Buttons.swift
         
     | 
| 
      
 3 
     | 
    
         
            +
            //  MVCGEN
         
     | 
| 
      
 4 
     | 
    
         
            +
            //
         
     | 
| 
      
 5 
     | 
    
         
            +
            //  Created by Daniel Martinez on 23/7/18.
         
     | 
| 
      
 6 
     | 
    
         
            +
            //  Copyright © 2018 DanielMartinez. All rights reserved.
         
     | 
| 
      
 7 
     | 
    
         
            +
            //
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            import UIKit
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            class LoadingButton: UIButton {
         
     | 
| 
      
 12 
     | 
    
         
            +
                
         
     | 
| 
      
 13 
     | 
    
         
            +
                var originalButtonText: String?
         
     | 
| 
      
 14 
     | 
    
         
            +
                var activityIndicator: UIActivityIndicatorView!
         
     | 
| 
      
 15 
     | 
    
         
            +
                var activityIndicatorColor: UIColor = UIColor.white {
         
     | 
| 
      
 16 
     | 
    
         
            +
                    didSet {
         
     | 
| 
      
 17 
     | 
    
         
            +
                        if self.activityIndicator != nil {
         
     | 
| 
      
 18 
     | 
    
         
            +
                            self.activityIndicator.color = activityIndicatorColor
         
     | 
| 
      
 19 
     | 
    
         
            +
                        }
         
     | 
| 
      
 20 
     | 
    
         
            +
                    }
         
     | 
| 
      
 21 
     | 
    
         
            +
                }
         
     | 
| 
      
 22 
     | 
    
         
            +
                
         
     | 
| 
      
 23 
     | 
    
         
            +
                func showLoading() {
         
     | 
| 
      
 24 
     | 
    
         
            +
                    self.isEnabled = false
         
     | 
| 
      
 25 
     | 
    
         
            +
                    originalButtonText = self.titleLabel?.text
         
     | 
| 
      
 26 
     | 
    
         
            +
                    self.setTitle("", for: .normal)
         
     | 
| 
      
 27 
     | 
    
         
            +
                    
         
     | 
| 
      
 28 
     | 
    
         
            +
                    if (activityIndicator == nil) {
         
     | 
| 
      
 29 
     | 
    
         
            +
                        activityIndicator = createActivityIndicator()
         
     | 
| 
      
 30 
     | 
    
         
            +
                    }
         
     | 
| 
      
 31 
     | 
    
         
            +
                    
         
     | 
| 
      
 32 
     | 
    
         
            +
                    showSpinning()
         
     | 
| 
      
 33 
     | 
    
         
            +
                }
         
     | 
| 
      
 34 
     | 
    
         
            +
                
         
     | 
| 
      
 35 
     | 
    
         
            +
                func hideLoading() {
         
     | 
| 
      
 36 
     | 
    
         
            +
                    self.isEnabled = true
         
     | 
| 
      
 37 
     | 
    
         
            +
                    self.setTitle(originalButtonText, for: .normal)
         
     | 
| 
      
 38 
     | 
    
         
            +
                    if let activityIndicator = self.activityIndicator {
         
     | 
| 
      
 39 
     | 
    
         
            +
                        activityIndicator.stopAnimating()
         
     | 
| 
      
 40 
     | 
    
         
            +
                    }
         
     | 
| 
      
 41 
     | 
    
         
            +
                }
         
     | 
| 
      
 42 
     | 
    
         
            +
                
         
     | 
| 
      
 43 
     | 
    
         
            +
                private func createActivityIndicator() -> UIActivityIndicatorView {
         
     | 
| 
      
 44 
     | 
    
         
            +
                    let activityIndicator = UIActivityIndicatorView()
         
     | 
| 
      
 45 
     | 
    
         
            +
                    activityIndicator.hidesWhenStopped = true
         
     | 
| 
      
 46 
     | 
    
         
            +
                    activityIndicator.color = activityIndicatorColor
         
     | 
| 
      
 47 
     | 
    
         
            +
                    return activityIndicator
         
     | 
| 
      
 48 
     | 
    
         
            +
                }
         
     | 
| 
      
 49 
     | 
    
         
            +
                
         
     | 
| 
      
 50 
     | 
    
         
            +
                private func showSpinning() {
         
     | 
| 
      
 51 
     | 
    
         
            +
                    activityIndicator.translatesAutoresizingMaskIntoConstraints = false
         
     | 
| 
      
 52 
     | 
    
         
            +
                    self.addSubview(activityIndicator)
         
     | 
| 
      
 53 
     | 
    
         
            +
                    centerActivityIndicatorInButton()
         
     | 
| 
      
 54 
     | 
    
         
            +
                    activityIndicator.startAnimating()
         
     | 
| 
      
 55 
     | 
    
         
            +
                }
         
     | 
| 
      
 56 
     | 
    
         
            +
                
         
     | 
| 
      
 57 
     | 
    
         
            +
                private func centerActivityIndicatorInButton() {
         
     | 
| 
      
 58 
     | 
    
         
            +
                    let xCenterConstraint = NSLayoutConstraint(item: self, attribute: .centerX, relatedBy: .equal, toItem: activityIndicator, attribute: .centerX, multiplier: 1, constant: 0)
         
     | 
| 
      
 59 
     | 
    
         
            +
                    self.addConstraint(xCenterConstraint)
         
     | 
| 
      
 60 
     | 
    
         
            +
                    
         
     | 
| 
      
 61 
     | 
    
         
            +
                    let yCenterConstraint = NSLayoutConstraint(item: self, attribute: .centerY, relatedBy: .equal, toItem: activityIndicator, attribute: .centerY, multiplier: 1, constant: 0)
         
     | 
| 
      
 62 
     | 
    
         
            +
                    self.addConstraint(yCenterConstraint)
         
     | 
| 
      
 63 
     | 
    
         
            +
                }
         
     | 
| 
      
 64 
     | 
    
         
            +
                
         
     | 
| 
      
 65 
     | 
    
         
            +
            }
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            @IBDesignable
         
     | 
| 
      
 68 
     | 
    
         
            +
            class GradientButton: UIButton {
         
     | 
| 
      
 69 
     | 
    
         
            +
                let gradientLayer = CAGradientLayer()
         
     | 
| 
      
 70 
     | 
    
         
            +
                
         
     | 
| 
      
 71 
     | 
    
         
            +
                @IBInspectable
         
     | 
| 
      
 72 
     | 
    
         
            +
                var topGradientColor: UIColor? {
         
     | 
| 
      
 73 
     | 
    
         
            +
                    didSet {
         
     | 
| 
      
 74 
     | 
    
         
            +
                        setGradient(topGradientColor: topGradientColor, bottomGradientColor: bottomGradientColor)
         
     | 
| 
      
 75 
     | 
    
         
            +
                    }
         
     | 
| 
      
 76 
     | 
    
         
            +
                }
         
     | 
| 
      
 77 
     | 
    
         
            +
                
         
     | 
| 
      
 78 
     | 
    
         
            +
                @IBInspectable
         
     | 
| 
      
 79 
     | 
    
         
            +
                var bottomGradientColor: UIColor? {
         
     | 
| 
      
 80 
     | 
    
         
            +
                    didSet {
         
     | 
| 
      
 81 
     | 
    
         
            +
                        setGradient(topGradientColor: topGradientColor, bottomGradientColor: bottomGradientColor)
         
     | 
| 
      
 82 
     | 
    
         
            +
                    }
         
     | 
| 
      
 83 
     | 
    
         
            +
                }
         
     | 
| 
      
 84 
     | 
    
         
            +
                
         
     | 
| 
      
 85 
     | 
    
         
            +
                private func setGradient(topGradientColor: UIColor?, bottomGradientColor: UIColor?) {
         
     | 
| 
      
 86 
     | 
    
         
            +
                    if let topGradientColor = topGradientColor, let bottomGradientColor = bottomGradientColor {
         
     | 
| 
      
 87 
     | 
    
         
            +
                        gradientLayer.frame = bounds
         
     | 
| 
      
 88 
     | 
    
         
            +
                        gradientLayer.colors = [topGradientColor.cgColor, bottomGradientColor.cgColor]
         
     | 
| 
      
 89 
     | 
    
         
            +
                        gradientLayer.borderColor = layer.borderColor
         
     | 
| 
      
 90 
     | 
    
         
            +
                        gradientLayer.borderWidth = layer.borderWidth
         
     | 
| 
      
 91 
     | 
    
         
            +
                        gradientLayer.cornerRadius = layer.cornerRadius
         
     | 
| 
      
 92 
     | 
    
         
            +
                        layer.insertSublayer(gradientLayer, at: 0)
         
     | 
| 
      
 93 
     | 
    
         
            +
                    } else {
         
     | 
| 
      
 94 
     | 
    
         
            +
                        gradientLayer.removeFromSuperlayer()
         
     | 
| 
      
 95 
     | 
    
         
            +
                    }
         
     | 
| 
      
 96 
     | 
    
         
            +
                }
         
     | 
| 
      
 97 
     | 
    
         
            +
            }
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
            extension UIButton {
         
     | 
| 
      
 100 
     | 
    
         
            +
                
         
     | 
| 
      
 101 
     | 
    
         
            +
                func addShadow(){
         
     | 
| 
      
 102 
     | 
    
         
            +
                    // Shadow and Radius
         
     | 
| 
      
 103 
     | 
    
         
            +
                    self.layer.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.15).cgColor
         
     | 
| 
      
 104 
     | 
    
         
            +
                    self.layer.shadowOffset = CGSize(width: 0.0, height: 2.0)
         
     | 
| 
      
 105 
     | 
    
         
            +
                    self.layer.shadowOpacity = 1.0
         
     | 
| 
      
 106 
     | 
    
         
            +
                    self.layer.shadowRadius = 0.0
         
     | 
| 
      
 107 
     | 
    
         
            +
                    self.layer.masksToBounds = false
         
     | 
| 
      
 108 
     | 
    
         
            +
                }
         
     | 
| 
      
 109 
     | 
    
         
            +
            }
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,32 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            //
         
     | 
| 
      
 2 
     | 
    
         
            +
            //  ColorHex.swift
         
     | 
| 
      
 3 
     | 
    
         
            +
            //  MVCGEN
         
     | 
| 
      
 4 
     | 
    
         
            +
            //
         
     | 
| 
      
 5 
     | 
    
         
            +
            //  Created by Daniel Martinez on 23/7/18.
         
     | 
| 
      
 6 
     | 
    
         
            +
            //  Copyright © 2018 DanielMartinez. All rights reserved.
         
     | 
| 
      
 7 
     | 
    
         
            +
            //
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            import UIKit
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            extension UIColor {
         
     | 
| 
      
 12 
     | 
    
         
            +
                
         
     | 
| 
      
 13 
     | 
    
         
            +
                convenience init(hex: String) {
         
     | 
| 
      
 14 
     | 
    
         
            +
                    let scanner = Scanner(string: hex)
         
     | 
| 
      
 15 
     | 
    
         
            +
                    scanner.scanLocation = 0
         
     | 
| 
      
 16 
     | 
    
         
            +
                    
         
     | 
| 
      
 17 
     | 
    
         
            +
                    var rgbValue: UInt64 = 0
         
     | 
| 
      
 18 
     | 
    
         
            +
                    
         
     | 
| 
      
 19 
     | 
    
         
            +
                    scanner.scanHexInt64(&rgbValue)
         
     | 
| 
      
 20 
     | 
    
         
            +
                    
         
     | 
| 
      
 21 
     | 
    
         
            +
                    let r = (rgbValue & 0xff0000) >> 16
         
     | 
| 
      
 22 
     | 
    
         
            +
                    let g = (rgbValue & 0xff00) >> 8
         
     | 
| 
      
 23 
     | 
    
         
            +
                    let b = rgbValue & 0xff
         
     | 
| 
      
 24 
     | 
    
         
            +
                    
         
     | 
| 
      
 25 
     | 
    
         
            +
                    self.init(
         
     | 
| 
      
 26 
     | 
    
         
            +
                        red: CGFloat(r) / 0xff,
         
     | 
| 
      
 27 
     | 
    
         
            +
                        green: CGFloat(g) / 0xff,
         
     | 
| 
      
 28 
     | 
    
         
            +
                        blue: CGFloat(b) / 0xff, alpha: 1
         
     | 
| 
      
 29 
     | 
    
         
            +
                    )
         
     | 
| 
      
 30 
     | 
    
         
            +
                }
         
     | 
| 
      
 31 
     | 
    
         
            +
                
         
     | 
| 
      
 32 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,98 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            //
         
     | 
| 
      
 2 
     | 
    
         
            +
            //  Config.swift
         
     | 
| 
      
 3 
     | 
    
         
            +
            //  MVCGEN
         
     | 
| 
      
 4 
     | 
    
         
            +
            //
         
     | 
| 
      
 5 
     | 
    
         
            +
            //  Created by Daniel Martinez on 23/7/18.
         
     | 
| 
      
 6 
     | 
    
         
            +
            //  Copyright © 2018 DanielMartinez. All rights reserved.
         
     | 
| 
      
 7 
     | 
    
         
            +
            //
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            import Alamofire
         
     | 
| 
      
 10 
     | 
    
         
            +
            import SwiftyJSON
         
     | 
| 
      
 11 
     | 
    
         
            +
            import NotificationBannerSwift
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            class APIHelper {
         
     | 
| 
      
 14 
     | 
    
         
            +
                
         
     | 
| 
      
 15 
     | 
    
         
            +
                static let sharedInstance = APIHelper()
         
     | 
| 
      
 16 
     | 
    
         
            +
                
         
     | 
| 
      
 17 
     | 
    
         
            +
                lazy var servicesURL = Config.sharedInstance.servicesURL()
         
     | 
| 
      
 18 
     | 
    
         
            +
                
         
     | 
| 
      
 19 
     | 
    
         
            +
                lazy var servicesVersion = Config.sharedInstance.servicesVersion()
         
     | 
| 
      
 20 
     | 
    
         
            +
                
         
     | 
| 
      
 21 
     | 
    
         
            +
                lazy var successBanner = NotificationBanner(title: "", subtitle: "", style: .success)
         
     | 
| 
      
 22 
     | 
    
         
            +
                
         
     | 
| 
      
 23 
     | 
    
         
            +
                lazy var errorBanner = NotificationBanner(title: "", subtitle: "", style: .danger)
         
     | 
| 
      
 24 
     | 
    
         
            +
                
         
     | 
| 
      
 25 
     | 
    
         
            +
                func getHeaders() -> [String : String]? {
         
     | 
| 
      
 26 
     | 
    
         
            +
                    if let userId = UserDefaults.standard.value(forKey: Constants.userId) as? String, let token = UserDefaults.standard.value(forKey: Constants.userAuthTokenKey) as? String {
         
     | 
| 
      
 27 
     | 
    
         
            +
                        // Token stored in UserDefaults.
         
     | 
| 
      
 28 
     | 
    
         
            +
                        var userAuthB64 = "Basic "
         
     | 
| 
      
 29 
     | 
    
         
            +
                        let userAuth = "\(userId):\(token)"
         
     | 
| 
      
 30 
     | 
    
         
            +
                        let userAuthData = userAuth.data(using: .utf8)!
         
     | 
| 
      
 31 
     | 
    
         
            +
                        userAuthB64 += userAuthData.base64EncodedString(options: [])
         
     | 
| 
      
 32 
     | 
    
         
            +
                        
         
     | 
| 
      
 33 
     | 
    
         
            +
                        // TODO: check Accept variable, change mvcgen for project name
         
     | 
| 
      
 34 
     | 
    
         
            +
                        return [
         
     | 
| 
      
 35 
     | 
    
         
            +
                            "Authorization" : userAuthB64,
         
     | 
| 
      
 36 
     | 
    
         
            +
                            "Content-Type" : "application/json",
         
     | 
| 
      
 37 
     | 
    
         
            +
                            "Accept" : "application/vnd.mvcgen.v"+self.servicesVersion+"+json",
         
     | 
| 
      
 38 
     | 
    
         
            +
                            "X-app-version" : self.getVersionBuild(),
         
     | 
| 
      
 39 
     | 
    
         
            +
                            "X-app-device" : self.getDeviceInfo()
         
     | 
| 
      
 40 
     | 
    
         
            +
                        ]
         
     | 
| 
      
 41 
     | 
    
         
            +
                    }
         
     | 
| 
      
 42 
     | 
    
         
            +
                    return nil
         
     | 
| 
      
 43 
     | 
    
         
            +
                    
         
     | 
| 
      
 44 
     | 
    
         
            +
                }
         
     | 
| 
      
 45 
     | 
    
         
            +
                
         
     | 
| 
      
 46 
     | 
    
         
            +
                func getVersionBuild() -> String {
         
     | 
| 
      
 47 
     | 
    
         
            +
                    var versionBuild = ""
         
     | 
| 
      
 48 
     | 
    
         
            +
                    if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
         
     | 
| 
      
 49 
     | 
    
         
            +
                        versionBuild = version
         
     | 
| 
      
 50 
     | 
    
         
            +
                    }
         
     | 
| 
      
 51 
     | 
    
         
            +
                    if let buildVersion = Bundle.main.infoDictionary?["CFBundleVersion"] as? String {
         
     | 
| 
      
 52 
     | 
    
         
            +
                        versionBuild += " " + buildVersion
         
     | 
| 
      
 53 
     | 
    
         
            +
                    }
         
     | 
| 
      
 54 
     | 
    
         
            +
                    return versionBuild
         
     | 
| 
      
 55 
     | 
    
         
            +
                }
         
     | 
| 
      
 56 
     | 
    
         
            +
                
         
     | 
| 
      
 57 
     | 
    
         
            +
                func getDeviceInfo() -> String {
         
     | 
| 
      
 58 
     | 
    
         
            +
                    return UIDevice.current.model + " iOS: " + UIDevice.current.systemVersion
         
     | 
| 
      
 59 
     | 
    
         
            +
                }
         
     | 
| 
      
 60 
     | 
    
         
            +
                
         
     | 
| 
      
 61 
     | 
    
         
            +
                func wsResponse(onError error: Int){
         
     | 
| 
      
 62 
     | 
    
         
            +
                    switch error {
         
     | 
| 
      
 63 
     | 
    
         
            +
                    case 300..<400:
         
     | 
| 
      
 64 
     | 
    
         
            +
                        // Bad auth error
         
     | 
| 
      
 65 
     | 
    
         
            +
                        print("error is \(error)")
         
     | 
| 
      
 66 
     | 
    
         
            +
            //            let appDelegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
         
     | 
| 
      
 67 
     | 
    
         
            +
            //            appDelegate.logout()
         
     | 
| 
      
 68 
     | 
    
         
            +
                    case 801:
         
     | 
| 
      
 69 
     | 
    
         
            +
                        break
         
     | 
| 
      
 70 
     | 
    
         
            +
                    default:
         
     | 
| 
      
 71 
     | 
    
         
            +
                        print("error is \(error)")
         
     | 
| 
      
 72 
     | 
    
         
            +
                        break
         
     | 
| 
      
 73 
     | 
    
         
            +
                    }
         
     | 
| 
      
 74 
     | 
    
         
            +
                }
         
     | 
| 
      
 75 
     | 
    
         
            +
                
         
     | 
| 
      
 76 
     | 
    
         
            +
                func showSuccesMessage(with title : String, and subtitle : String){
         
     | 
| 
      
 77 
     | 
    
         
            +
                    NotificationBannerQueue.default.removeAll()
         
     | 
| 
      
 78 
     | 
    
         
            +
                    if !successBanner.isDisplaying{
         
     | 
| 
      
 79 
     | 
    
         
            +
                        successBanner.titleLabel?.text = title
         
     | 
| 
      
 80 
     | 
    
         
            +
                        successBanner.subtitleLabel?.text = subtitle
         
     | 
| 
      
 81 
     | 
    
         
            +
                        successBanner.show()
         
     | 
| 
      
 82 
     | 
    
         
            +
                    }
         
     | 
| 
      
 83 
     | 
    
         
            +
                }
         
     | 
| 
      
 84 
     | 
    
         
            +
                
         
     | 
| 
      
 85 
     | 
    
         
            +
                func showErrorMessage(with title : String, and subtitle : String){
         
     | 
| 
      
 86 
     | 
    
         
            +
                    NotificationBannerQueue.default.removeAll()
         
     | 
| 
      
 87 
     | 
    
         
            +
                    if !errorBanner.isDisplaying{
         
     | 
| 
      
 88 
     | 
    
         
            +
                        errorBanner.titleLabel?.text = title
         
     | 
| 
      
 89 
     | 
    
         
            +
                        errorBanner.subtitleLabel?.text = subtitle
         
     | 
| 
      
 90 
     | 
    
         
            +
                        errorBanner.show()
         
     | 
| 
      
 91 
     | 
    
         
            +
                    }
         
     | 
| 
      
 92 
     | 
    
         
            +
                }
         
     | 
| 
      
 93 
     | 
    
         
            +
            }
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
            enum VoidResult {
         
     | 
| 
      
 96 
     | 
    
         
            +
                case success
         
     | 
| 
      
 97 
     | 
    
         
            +
                case failure
         
     | 
| 
      
 98 
     | 
    
         
            +
            }
         
     |