From f1d80adf5727c7959b7cca82c402e1708b80508d Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 12 Apr 2019 15:32:43 -0400 Subject: [PATCH] delegate object and simple deprecation --- MVMCoreUI.xcodeproj/project.pbxproj | 4 ++++ MVMCoreUI/BaseControllers/MFViewController.h | 1 + MVMCoreUI/BaseControllers/MFViewController.m | 4 ++++ MVMCoreUI/OtherHandlers/DelegateObject.swift | 18 ++++++++++++++++++ .../OtherHandlers/MVMCoreUILoggingHandler.h | 1 - MVMCoreUI/TopAlert/MVMCoreUITopAlertBaseView.h | 1 - MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.h | 1 + 7 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 MVMCoreUI/OtherHandlers/DelegateObject.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 8a2e4453..dea12c71 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -157,6 +157,7 @@ D2A5146B2214905000345BFB /* ThreeLayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A5146A2214905000345BFB /* ThreeLayerViewController.swift */; }; D2C5001821F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h in Headers */ = {isa = PBXBuildFile; fileRef = D2C5001621F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; D2C5001921F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m in Sources */ = {isa = PBXBuildFile; fileRef = D2C5001721F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m */; }; + D2E1FADB2260D3D200AEFD8C /* DelegateObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FADA2260D3D200AEFD8C /* DelegateObject.swift */; }; DBC4391822442197001AB423 /* CaretView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBC4391622442196001AB423 /* CaretView.swift */; }; DBC4391922442197001AB423 /* DashLine.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBC4391722442197001AB423 /* DashLine.swift */; }; DBC4391B224421A0001AB423 /* CaretButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBC4391A224421A0001AB423 /* CaretButton.swift */; }; @@ -317,6 +318,7 @@ D2A5146A2214905000345BFB /* ThreeLayerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeLayerViewController.swift; sourceTree = ""; }; D2C5001621F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIViewControllerMappingObject.h; sourceTree = ""; }; D2C5001721F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIViewControllerMappingObject.m; sourceTree = ""; }; + D2E1FADA2260D3D200AEFD8C /* DelegateObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DelegateObject.swift; sourceTree = ""; }; DBC4391622442196001AB423 /* CaretView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaretView.swift; sourceTree = ""; }; DBC4391722442197001AB423 /* DashLine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DashLine.swift; sourceTree = ""; }; DBC4391A224421A0001AB423 /* CaretButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaretButton.swift; sourceTree = ""; }; @@ -634,6 +636,7 @@ D29DF27021E79B2C003B2FB9 /* OtherHandlers */ = { isa = PBXGroup; children = ( + D2E1FADA2260D3D200AEFD8C /* DelegateObject.swift */, D28B4F8821FF967C00712C7A /* MVMCoreUIObject.h */, D28B4F8921FF967C00712C7A /* MVMCoreUIObject.m */, D29DF27721E7A533003B2FB9 /* MVMCoreUISession.h */, @@ -865,6 +868,7 @@ D29770F221F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m in Sources */, DBC4391922442197001AB423 /* DashLine.swift in Sources */, D29DF29621E7ADB8003B2FB9 /* StackableViewController.m in Sources */, + D2E1FADB2260D3D200AEFD8C /* DelegateObject.swift in Sources */, D22D1F1F220343560077CEC0 /* MVMCoreUICheckMarkView.m in Sources */, D282AAB4223FDDAE00C46919 /* MFLoadImageView.swift in Sources */, D29DF11721E6805F003B2FB9 /* UIColor+MFConvenience.m in Sources */, diff --git a/MVMCoreUI/BaseControllers/MFViewController.h b/MVMCoreUI/BaseControllers/MFViewController.h index 8d5c6678..8c1d5766 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.h +++ b/MVMCoreUI/BaseControllers/MFViewController.h @@ -31,6 +31,7 @@ @class MainMenuViewController; @class MVMCoreUITabBarPageControlViewController; @class MVMAnimationManager; +@class DelegateObject; @interface MFViewController : UIViewController diff --git a/MVMCoreUI/BaseControllers/MFViewController.m b/MVMCoreUI/BaseControllers/MFViewController.m index c4ee3756..6b27c7d9 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.m +++ b/MVMCoreUI/BaseControllers/MFViewController.m @@ -180,6 +180,10 @@ return YES; } +- (nullable DelegateObject *)delegateObject { + return [MVMCoreUIDelegateObject createWithDelegateForAll:self]; +} + #pragma mark - Response Handling - (void)observeForResponseJSONUpdates { diff --git a/MVMCoreUI/OtherHandlers/DelegateObject.swift b/MVMCoreUI/OtherHandlers/DelegateObject.swift new file mode 100644 index 00000000..e6c13dd5 --- /dev/null +++ b/MVMCoreUI/OtherHandlers/DelegateObject.swift @@ -0,0 +1,18 @@ +// +// DelegateObject.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 4/12/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +import UIKit + +@objc(MVMCoreUIDelegateObject) +open class DelegateObject: MVMCore.DelegateObject { + public weak var formValidationProtocol: FormValidationProtocol? + + open override func setAll(withDelegate delegate: Any) { + formValidationProtocol = delegate as? FormValidationProtocol + } +} diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h index 56bb60a2..003d67f8 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h +++ b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h @@ -7,7 +7,6 @@ // @import MVMCore.MVMCoreLoggingHandler; -@class MVMCoreTopAlertObject; @class MFViewController; NS_ASSUME_NONNULL_BEGIN diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertBaseView.h b/MVMCoreUI/TopAlert/MVMCoreUITopAlertBaseView.h index 9391356c..46b392b7 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertBaseView.h +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertBaseView.h @@ -10,7 +10,6 @@ #import #import -@class MVMCoreTopAlertObject; @class MFCustomButton; @interface MVMCoreUITopAlertBaseView : MFView diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.h b/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.h index 6ebd1026..50dd9b26 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.h +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.h @@ -11,6 +11,7 @@ #import @class PrimaryButton; +@class MVMCoreTopAlertObject; @interface MVMCoreUITopAlertMainView : MVMCoreUITopAlertBaseView