This commit is contained in:
Pfeil, Scott Robert 2020-03-13 10:04:47 -04:00
parent dfc9157c26
commit 335ec160b5
38 changed files with 639 additions and 175 deletions

View File

@ -178,6 +178,7 @@
C7F8012123E8303200396FBD /* ListRVWheel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7F8012023E8303200396FBD /* ListRVWheel.swift */; };
C7F8012323E846C300396FBD /* ListRVWheelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7F8012223E846C300396FBD /* ListRVWheelModel.swift */; };
D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */; };
D20FB165241A5D75004AFC3A /* NavigationItemModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20FB164241A5D75004AFC3A /* NavigationItemModelProtocol.swift */; };
D213347723843825008E41B3 /* Line.swift in Sources */ = {isa = PBXBuildFile; fileRef = D213347623843825008E41B3 /* Line.swift */; };
D21EE53C23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D21EE53B23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift */; };
D224798A2314445E003FCCF9 /* LabelToggle.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22479892314445E003FCCF9 /* LabelToggle.swift */; };
@ -285,11 +286,11 @@
D29DF28421E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF28221E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.h */; settings = {ATTRIBUTES = (Public, ); }; };
D29DF28B21E7AC2B003B2FB9 /* ViewConstrainingView.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF28721E7AC2B003B2FB9 /* ViewConstrainingView.h */; settings = {ATTRIBUTES = (Public, ); }; };
D29DF28C21E7AC2B003B2FB9 /* ViewConstrainingView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF28821E7AC2B003B2FB9 /* ViewConstrainingView.m */; };
D29DF29521E7ADB8003B2FB9 /* ProgrammaticScrollViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF28D21E7ADB8003B2FB9 /* ProgrammaticScrollViewController.m */; };
D29DF29521E7ADB8003B2FB9 /* MFProgrammaticScrollViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF28D21E7ADB8003B2FB9 /* MFProgrammaticScrollViewController.m */; };
D29DF29621E7ADB8003B2FB9 /* StackableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF28E21E7ADB8003B2FB9 /* StackableViewController.m */; };
D29DF29721E7ADB8003B2FB9 /* MFScrollingViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF28F21E7ADB8003B2FB9 /* MFScrollingViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
D29DF29821E7ADB8003B2FB9 /* MFScrollingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF29021E7ADB8003B2FB9 /* MFScrollingViewController.m */; };
D29DF29921E7ADB8003B2FB9 /* ProgrammaticScrollViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF29121E7ADB8003B2FB9 /* ProgrammaticScrollViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
D29DF29921E7ADB8003B2FB9 /* MFProgrammaticScrollViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF29121E7ADB8003B2FB9 /* MFProgrammaticScrollViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
D29DF29A21E7ADB8003B2FB9 /* MFProgrammaticTableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF29221E7ADB8003B2FB9 /* MFProgrammaticTableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
D29DF29B21E7ADB9003B2FB9 /* StackableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF29321E7ADB8003B2FB9 /* StackableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
D29DF29C21E7ADB9003B2FB9 /* MFProgrammaticTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF29421E7ADB8003B2FB9 /* MFProgrammaticTableViewController.m */; };
@ -342,6 +343,9 @@
D2A638FD22CA98280052ED1F /* HeadlineBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A638FC22CA98280052ED1F /* HeadlineBody.swift */; };
D2A6390122CBB1820052ED1F /* Carousel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A6390022CBB1820052ED1F /* Carousel.swift */; };
D2A6390522CBCE160052ED1F /* MoleculeCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A6390422CBCE160052ED1F /* MoleculeCollectionViewCell.swift */; };
D2A92882241AAB67004E01C6 /* ScrollingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A92881241AAB67004E01C6 /* ScrollingViewController.swift */; };
D2A92884241ACB25004E01C6 /* ProgrammaticScrollViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A92883241ACB25004E01C6 /* ProgrammaticScrollViewController.swift */; };
D2A92886241ACD99004E01C6 /* ProgrammaticTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A92885241ACD99004E01C6 /* ProgrammaticTableViewController.swift */; };
D2B18B7F2360913400A9AEDC /* Control.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2B18B7E2360913400A9AEDC /* Control.swift */; };
D2B18B812360945C00A9AEDC /* View.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2B18B802360945C00A9AEDC /* View.swift */; };
D2B18B922361E65A00A9AEDC /* CoreUIObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2B18B912361E65A00A9AEDC /* CoreUIObject.swift */; };
@ -539,6 +543,7 @@
C7F8012023E8303200396FBD /* ListRVWheel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRVWheel.swift; sourceTree = "<group>"; };
C7F8012223E846C300396FBD /* ListRVWheelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRVWheelModel.swift; sourceTree = "<group>"; };
D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoButtonView.swift; sourceTree = "<group>"; };
D20FB164241A5D75004AFC3A /* NavigationItemModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationItemModelProtocol.swift; sourceTree = "<group>"; };
D213347623843825008E41B3 /* Line.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Line.swift; sourceTree = "<group>"; };
D21EE53B23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSLayoutConstraintAxis+Extension.swift"; sourceTree = "<group>"; };
D22479892314445E003FCCF9 /* LabelToggle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelToggle.swift; sourceTree = "<group>"; };
@ -666,11 +671,11 @@
D29DF28221E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreUICommonViewsUtility.h; sourceTree = "<group>"; };
D29DF28721E7AC2B003B2FB9 /* ViewConstrainingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewConstrainingView.h; sourceTree = "<group>"; };
D29DF28821E7AC2B003B2FB9 /* ViewConstrainingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewConstrainingView.m; sourceTree = "<group>"; };
D29DF28D21E7ADB8003B2FB9 /* ProgrammaticScrollViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProgrammaticScrollViewController.m; sourceTree = "<group>"; };
D29DF28D21E7ADB8003B2FB9 /* MFProgrammaticScrollViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFProgrammaticScrollViewController.m; sourceTree = "<group>"; };
D29DF28E21E7ADB8003B2FB9 /* StackableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StackableViewController.m; sourceTree = "<group>"; };
D29DF28F21E7ADB8003B2FB9 /* MFScrollingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFScrollingViewController.h; sourceTree = "<group>"; };
D29DF29021E7ADB8003B2FB9 /* MFScrollingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFScrollingViewController.m; sourceTree = "<group>"; };
D29DF29121E7ADB8003B2FB9 /* ProgrammaticScrollViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProgrammaticScrollViewController.h; sourceTree = "<group>"; };
D29DF29121E7ADB8003B2FB9 /* MFProgrammaticScrollViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFProgrammaticScrollViewController.h; sourceTree = "<group>"; };
D29DF29221E7ADB8003B2FB9 /* MFProgrammaticTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFProgrammaticTableViewController.h; sourceTree = "<group>"; };
D29DF29321E7ADB8003B2FB9 /* StackableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackableViewController.h; sourceTree = "<group>"; };
D29DF29421E7ADB8003B2FB9 /* MFProgrammaticTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFProgrammaticTableViewController.m; sourceTree = "<group>"; };
@ -717,6 +722,9 @@
D2A638FC22CA98280052ED1F /* HeadlineBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBody.swift; sourceTree = "<group>"; };
D2A6390022CBB1820052ED1F /* Carousel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Carousel.swift; sourceTree = "<group>"; };
D2A6390422CBCE160052ED1F /* MoleculeCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeCollectionViewCell.swift; sourceTree = "<group>"; };
D2A92881241AAB67004E01C6 /* ScrollingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollingViewController.swift; sourceTree = "<group>"; };
D2A92883241ACB25004E01C6 /* ProgrammaticScrollViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgrammaticScrollViewController.swift; sourceTree = "<group>"; };
D2A92885241ACD99004E01C6 /* ProgrammaticTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgrammaticTableViewController.swift; sourceTree = "<group>"; };
D2B18B7E2360913400A9AEDC /* Control.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Control.swift; sourceTree = "<group>"; };
D2B18B802360945C00A9AEDC /* View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = View.swift; sourceTree = "<group>"; };
D2B18B912361E65A00A9AEDC /* CoreUIObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreUIObject.swift; sourceTree = "<group>"; };
@ -927,8 +935,20 @@
D213347423842FE3008E41B3 /* Controllers */ = {
isa = PBXGroup;
children = (
D29DF16021E69996003B2FB9 /* MFViewController.h */,
D29DF15F21E69996003B2FB9 /* MFViewController.m */,
017BEB3B2361EA1D0024EF95 /* MFViewController+Model.swift */,
011D9627240EFA1E000E3791 /* MFViewController+Form.swift */,
D29DF28F21E7ADB8003B2FB9 /* MFScrollingViewController.h */,
D29DF29021E7ADB8003B2FB9 /* MFScrollingViewController.m */,
D29DF29121E7ADB8003B2FB9 /* MFProgrammaticScrollViewController.h */,
D29DF28D21E7ADB8003B2FB9 /* MFProgrammaticScrollViewController.m */,
D29DF29321E7ADB8003B2FB9 /* StackableViewController.h */,
D29DF28E21E7ADB8003B2FB9 /* StackableViewController.m */,
D29DF29221E7ADB8003B2FB9 /* MFProgrammaticTableViewController.h */,
D29DF29421E7ADB8003B2FB9 /* MFProgrammaticTableViewController.m */,
D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */,
D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */,
D29770F021F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.h */,
D29770F121F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.m */,
D29770EF21F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.h */,
@ -1269,6 +1289,7 @@
017BEB47236230DB0024EF95 /* MoleculeViewProtocol.swift */,
017BEB49236235BA0024EF95 /* ModelMoleculeViewProtocol.swift */,
D260105723CF9CC500764D80 /* Doughnut */,
D20FB164241A5D75004AFC3A /* NavigationItemModelProtocol.swift */,
);
path = Molecules;
sourceTree = "<group>";
@ -1276,23 +1297,14 @@
D29DF10F21E67A7D003B2FB9 /* BaseControllers */ = {
isa = PBXGroup;
children = (
D29DF16021E69996003B2FB9 /* MFViewController.h */,
D29DF15F21E69996003B2FB9 /* MFViewController.m */,
017BEB3B2361EA1D0024EF95 /* MFViewController+Model.swift */,
011D9627240EFA1E000E3791 /* MFViewController+Form.swift */,
D29DF28F21E7ADB8003B2FB9 /* MFScrollingViewController.h */,
D29DF29021E7ADB8003B2FB9 /* MFScrollingViewController.m */,
D29DF29121E7ADB8003B2FB9 /* ProgrammaticScrollViewController.h */,
D29DF28D21E7ADB8003B2FB9 /* ProgrammaticScrollViewController.m */,
D29DF29221E7ADB8003B2FB9 /* MFProgrammaticTableViewController.h */,
D29DF29421E7ADB8003B2FB9 /* MFProgrammaticTableViewController.m */,
D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */,
D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */,
D29DF2CC21E7C104003B2FB9 /* MFLoadingViewController.h */,
D29DF2CD21E7C104003B2FB9 /* MFLoadingViewController.m */,
D2A5146A2214905000345BFB /* ThreeLayerViewController.swift */,
D2E1FADE2268B8E700AEFD8C /* ThreeLayerTableViewController.swift */,
D2C521A823EDE79E00CA2634 /* ViewController.swift */,
D2A92881241AAB67004E01C6 /* ScrollingViewController.swift */,
D2A92883241ACB25004E01C6 /* ProgrammaticScrollViewController.swift */,
D2A92885241ACD99004E01C6 /* ProgrammaticTableViewController.swift */,
);
path = BaseControllers;
sourceTree = "<group>";
@ -1618,7 +1630,7 @@
D29DF2A921E7B2F9003B2FB9 /* MVMCoreUIConstants.h in Headers */,
0198F7A62256A80B0066C936 /* MFRadioButton.h in Headers */,
D22D1F1A220341F60077CEC0 /* MVMCoreUICheckBox.h in Headers */,
D29DF29921E7ADB8003B2FB9 /* ProgrammaticScrollViewController.h in Headers */,
D29DF29921E7ADB8003B2FB9 /* MFProgrammaticScrollViewController.h in Headers */,
D29DF11C21E684A9003B2FB9 /* MVMCoreUISplitViewController.h in Headers */,
D29DF29B21E7ADB9003B2FB9 /* StackableViewController.h in Headers */,
D29770F421F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.h in Headers */,
@ -1821,6 +1833,7 @@
D2E2A99823D8D63C000B42E6 /* ActionDetailWithImageModel.swift in Sources */,
D2E2A99D23DA3217000B42E6 /* UIStackViewAlignment+Extension.swift in Sources */,
01EB369423609801006832FA /* HeadlineBodyModel.swift in Sources */,
D2A92884241ACB25004E01C6 /* ProgrammaticScrollViewController.swift in Sources */,
0A21DB7F235DECC500C160A2 /* EntryField.swift in Sources */,
D2E2A99F23E07F8A000B42E6 /* PillButton.swift in Sources */,
D2C5001921F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m in Sources */,
@ -1874,6 +1887,7 @@
D2D6CD4022E78C1A00D701B8 /* Scroller.swift in Sources */,
0A7EF85F23D8ABC500B2AAD1 /* MdnEntryFieldModel.swift in Sources */,
011D959B240451E3000E3791 /* RuleRequiredModel.swift in Sources */,
D2A92886241ACD99004E01C6 /* ProgrammaticTableViewController.swift in Sources */,
01509D952327ED1900EF99AA /* HeadlineBodyLinkToggle.swift in Sources */,
31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */,
D260105523CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift in Sources */,
@ -1946,7 +1960,7 @@
D2A6390122CBB1820052ED1F /* Carousel.swift in Sources */,
D29DF2C721E7BF57003B2FB9 /* MFTabBarInteractor.m in Sources */,
C7F8012123E8303200396FBD /* ListRVWheel.swift in Sources */,
D29DF29521E7ADB8003B2FB9 /* ProgrammaticScrollViewController.m in Sources */,
D29DF29521E7ADB8003B2FB9 /* MFProgrammaticScrollViewController.m in Sources */,
D2FB151B23A2B65B00C20E10 /* MoleculeContainer.swift in Sources */,
D2A638FD22CA98280052ED1F /* HeadlineBody.swift in Sources */,
D29DF16121E69996003B2FB9 /* MFViewController.m in Sources */,
@ -1956,9 +1970,11 @@
D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */,
525019E72406853600EED91C /* ListFourColumnDataUsageDivider.swift in Sources */,
0AE98BB323FF0934004C5109 /* ExternalLinkModel.swift in Sources */,
D20FB165241A5D75004AFC3A /* NavigationItemModelProtocol.swift in Sources */,
DB06250B2293456500B72DD3 /* LeftRightLabelView.swift in Sources */,
0A21DB89235E06EF00C160A2 /* MFMdnTextField.m in Sources */,
D224798A2314445E003FCCF9 /* LabelToggle.swift in Sources */,
D2A92882241AAB67004E01C6 /* ScrollingViewController.swift in Sources */,
D22D1F47220496A30077CEC0 /* MVMCoreUISwitch.m in Sources */,
C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */,
0AE98BB523FF18D2004C5109 /* Arrow.swift in Sources */,

View File

@ -311,7 +311,7 @@ import UIKit
uiTextFieldDelegate = delegateObject?.uiTextFieldDelegate
observingTextFieldDelegate = delegateObject?.observingTextFieldDelegate
MVMCoreUICommonViewsUtility.addDismissToolbar(textField, delegate: uiTextFieldDelegate)
//MVMCoreUICommonViewsUtility.addDismissToolbar(textField, delegate: uiTextFieldDelegate)
}
}

View File

@ -0,0 +1,56 @@
//
// ProgrammaticScrollViewController.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 3/12/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
open class ProgrammaticScrollViewController: ScrollingViewController {
public var topConstraint: NSLayoutConstraint?
public var bottomConstraint: NSLayoutConstraint?
public override init(with scrollView: UIScrollView) {
super.init(with: scrollView)
}
public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
required public init?(coder: NSCoder) {
super.init(coder: coder)
}
open override func loadView() {
let view = UIView()
view.backgroundColor = .white
let scrollView = UIScrollView()
scrollView.backgroundColor = .clear
scrollView.translatesAutoresizingMaskIntoConstraints = true
view.addSubview(scrollView)
// Sets the constraints for the scroll view
let constraints = NSLayoutConstraint.constraintPinSubview(toSuperview: scrollView)
topConstraint = constraints?[ConstraintTop] as? NSLayoutConstraint
bottomConstraint = constraints?[ConstraintBot] as? NSLayoutConstraint
let contentView = MVMCoreUICommonViewsUtility.commonView()
scrollView.addSubview(contentView)
// Sets the constraints for the content view
NSLayoutConstraint.constraintPinSubview(toSuperview: contentView)
// Super will set later.
contentWidthConstraint = contentView.widthAnchor.constraint(equalToConstant: 320.0)
contentWidthConstraint?.isActive = true
self.contentView = contentView
self.scrollView = scrollView
self.view = view
}
}

View File

@ -0,0 +1,81 @@
//
// ProgrammaticTableViewController.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 3/12/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
open class ProgrammaticTableViewController: ProgrammaticScrollViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet public var tableView: UITableView!
public init(with tableView: UITableView) {
self.tableView = tableView
super.init(with: tableView)
}
required public init?(coder: NSCoder) {
super.init(coder: coder)
}
public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
open override func loadView() {
let view = UIView()
view.backgroundColor = .white
let tableView = createTableView()
tableView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(tableView)
// Sets the constraints for the scroll view
let constraints = NSLayoutConstraint.constraintPinSubview(toSuperview: tableView)
topConstraint = constraints?[ConstraintTop] as? NSLayoutConstraint
bottomConstraint = constraints?[ConstraintBot] as? NSLayoutConstraint
self.tableView = tableView
scrollView = tableView
self.view = view
}
/// This class should create the table view that will be used here. Subclass this for different table styles.
open func createTableView() -> UITableView {
let tableView = UITableView(frame: .zero, style: .grouped)
tableView.backgroundColor = .clear
tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
tableView.delegate = self
tableView.dataSource = self
tableView.insetsContentViewsToSafeArea = false
return tableView
}
// Registers classes and nibs. Can subclass for different nibs. Can call super and then add new ones after as well.
open func registerWithTable() {}
/// Sets the table to have no section headers or footers.
open func setNoSectionHeadersFooters() {
tableView.sectionHeaderHeight = CGFloat.leastNormalMagnitude
tableView.sectionFooterHeight = CGFloat.leastNormalMagnitude
}
/// For subclassing, returns the number of sections for table. This function calls numberOfSectionsForTableview aftre ensuring the table is setup properly.
open func getNumberOfSections() -> Int {
return 1
}
open func numberOfSections(in tableView: UITableView) -> Int {
return tableView.bounds.width > 1 ? getNumberOfSections() : 0
}
open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 0
}
open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return UITableViewCell()
}
}

View File

@ -0,0 +1,109 @@
//
// ScrollingViewController.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 3/12/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
open class ScrollingViewController: ViewController {
public var dismissKeyboardTapGesture: UITapGestureRecognizer?
@IBOutlet public var scrollView: UIScrollView!
public var contentView: UIView?
public var contentWidthConstraint: NSLayoutConstraint?
private var keyboardNotificationsAdded = false
private var keyboardIsShowing = false
private var preKeyboardContentInset: UIEdgeInsets?
public init(with scrollView: UIScrollView) {
self.scrollView = scrollView
super.init(nibName: nil, bundle: nil)
}
required public init?(coder: NSCoder) {
super.init(coder: coder)
}
public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
// MARK: - View Life Cycle
open override func viewDidLoad() {
super.viewDidLoad()
// Adds the tap gesture to dismiss the keyboard.
dismissKeyboardTapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissFieldInput(sender:)))
view.addGestureRecognizer(dismissKeyboardTapGesture!)
dismissKeyboardTapGesture?.isEnabled = false
scrollView.alwaysBounceVertical = false
scrollView.delegate = self
}
open override func updateViewConstraints() {
super.updateViewConstraints()
// Sets the width of the content to the width of the screen.
contentWidthConstraint?.constant = view.bounds.width - scrollView.contentInset.left - scrollView.contentInset.right
}
open override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
view.setNeedsUpdateConstraints()
view.layoutSubviews()
}
open override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
registerForKeyboardNotifications()
}
// MARK: - Keyboard Handling
open func registerForKeyboardNotifications() {
if !keyboardNotificationsAdded {
keyboardNotificationsAdded = true
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillBeHidden(notification:)), name: UIResponder.keyboardWillHideNotification, object: nil)
}
}
open func unregisterForKeyboardNotifications() {
if keyboardNotificationsAdded {
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil)
keyboardNotificationsAdded = false
}
}
@objc open func keyboardWillShow(notification: Notification) {
// Stores the current scroll insets if the keyboard was hidden.
if !keyboardIsShowing {
preKeyboardContentInset = scrollView.contentInset
}
keyboardIsShowing = true
// Enables the tap gesture.
dismissKeyboardTapGesture?.isEnabled = true
MVMCoreUIUtility.setScrollViewInsetForKeyboardShow(notification, scrollView: scrollView, viewController: self) { [weak self] () -> CGRect in
return self?.rectToScrollToWhenKeyboardPopsUp() ?? .zero
}
}
@objc open func keyboardWillBeHidden(notification: Notification) {
keyboardIsShowing = false
// Disables the tap gesture.
dismissKeyboardTapGesture?.isEnabled = false
MVMCoreUIUtility.setScrollViewInsetForKeyboardHide(notification, scrollView: scrollView, viewController: self, contentInset: preKeyboardContentInset ?? scrollView.contentInset)
}
open func rectToScrollToWhenKeyboardPopsUp() -> CGRect? {
guard let field = selectedField,
let parent = selectedField?.superview else { return nil }
return scrollView.convert(field.frame, from: parent)
}
}

View File

@ -9,7 +9,7 @@
import UIKit
import MVMAnimationFramework
open class ThreeLayerTableViewController: MFProgrammaticTableViewController {
open class ThreeLayerTableViewController: ProgrammaticTableViewController {
// The three main views
private var topView: UIView?
private var bottomView: UIView?
@ -36,17 +36,17 @@ open class ThreeLayerTableViewController: MFProgrammaticTableViewController {
self.tableView?.reloadData()
}
open override func newDataBuildScreen() {
super.newDataBuildScreen()
open override func handleNewData() {
createViewForTableHeader()
createViewForTableFooter()
tableView?.reloadData()
super.handleNewData()
}
override open func viewDidLoad() {
super.viewDidLoad()
setToHaveNoSectionHeadersFooters()
// Do any additional setup after loading the view.
setNoSectionHeadersFooters()
}
//MARK: - Spacing
@ -227,26 +227,7 @@ open class ThreeLayerTableViewController: MFProgrammaticTableViewController {
return view
}
//MARK: - Scrollview
open override func scrollViewDidScroll(_ scrollView: UIScrollView) {
// To stop handscroll animation if animating after scroll
stopHandScrollAnimation(true)
}
deinit {
tableView?.delegate = nil
}
//MARK: - Animation
open override func setupIntroAnimations() {
if let topView = topView, topView.subviews.count > 0 {
introAnimationManager?.addAnimation(animation: MVMAnimations.fadeUpAnimation(view: topView))
}
if let tableView = tableView {
introAnimationManager?.addAnimation(animation: MVMAnimations.animateTableViewFadeInCells(tableView: tableView))
}
if let bottomView = bottomView, bottomView.subviews.count > 0 {
introAnimationManager?.addAnimation(animation: MVMAnimations.fadeUpAnimation(view: bottomView))
}
}
}

View File

@ -61,21 +61,25 @@ open class ThreeLayerViewController: ProgrammaticScrollViewController {
}
}
open override func newDataBuildScreen() {
super.newDataBuildScreen()
open override func handleNewData() {
// Removes the views
topView?.removeFromSuperview()
middleView?.removeFromSuperview()
bottomView?.removeFromSuperview()
safeAreaView?.removeFromSuperview()
MVMCoreUIStackableViewController.remove(contentView?.subviews)
if let subViews = contentView?.subviews {
for view in subViews {
view.removeFromSuperview()
}
}
// Reset constraints
bottomConstraint?.isActive = true
heightConstraint?.isActive = false
setupLayers()
super.handleNewData()
}
//MARK:-Functions to subclass
@ -241,18 +245,3 @@ extension ThreeLayerViewController {
}
}
}
//MARK:-Animation
extension ThreeLayerViewController {
open override func setupIntroAnimations() {
if let topView = topView, topView.subviews.count > 0 {
introAnimationManager?.addAnimation(animation: MVMAnimations.fadeUpAnimation(view: topView))
}
if let middleView = middleView, middleView.subviews.count > 0 {
introAnimationManager?.addAnimation(animation: MVMAnimations.fadeUpAnimation(view: middleView))
}
if let bottomView = bottomView, bottomView.subviews.count > 0 {
introAnimationManager?.addAnimation(animation: MVMAnimations.fadeUpAnimation(view: bottomView))
}
}
}

View File

@ -8,19 +8,110 @@
import UIKit
@objcMembers open class ViewController: UIViewController, MVMCoreViewControllerProtocol {
open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMCoreViewManagerViewControllerProtocol, MoleculeDelegateProtocol, FormHolderProtocol, MVMCoreActionDelegateProtocol, UITextFieldDelegate, UITextViewDelegate {
public var pageType: String?
public var loadObject: MVMCoreLoadObject?
public var pageModel: PageModelProtocol?
/// Set if this page is containted in a manager.
public var manager: (UIViewController & MVMCoreViewManagerProtocol)?
public var selfDelegateObject: MVMCoreUIDelegateObject?
public func delegateObject() -> DelegateObject? {
if selfDelegateObject == nil {
selfDelegateObject = MVMCoreUIDelegateObject.create(withDelegateForAll: self)
}
return selfDelegateObject
}
public var formValidator: FormValidator?
public var needsUpdateUI = true
private var observingForResponses = false
private var initialLoadFinished = false
private var previousScreenSize = CGSize.zero
public var selectedField: UIView?
// MARK: Response handling
public func shouldFinishProcessingLoad(_ loadObject: MVMCoreLoadObject, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject>) -> Bool {
/// Checks if the screen width has changed
open func screenSizeChanged() -> Bool {
return MVMCoreGetterUtility.cgfequalwiththreshold(previousScreenSize.width, view.bounds.size.width, 0.1)
}
// MARK: - Response handling
open func observeForResponseJSONUpdates() {
guard !observingForResponses,
(pagesToListenFor()?.count ?? 0 > 0 || modulesToListenFor()?.count ?? 0 > 0) else { return }
observingForResponses = true
NotificationCenter.default.addObserver(self, selector: #selector(responseJSONUpdated(notification:)), name: NSNotification.Name(rawValue: NotificationResponseLoaded), object: nil)
}
open func stopObservingForResponseJSONUpdates() {
guard observingForResponses else { return }
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NotificationResponseLoaded), object: nil)
observingForResponses = false
}
open func pagesToListenFor() -> [String]? {
guard let pageType = loadObject?.pageType else { return nil }
return [pageType]
}
open func modulesToListenFor() -> [String]? {
return loadObject?.requestParameters?.modules as? [String]
}
@objc open func responseJSONUpdated(notification: Notification) {
// Checks for a page we are listening for.
var newData = false
if let pagesLoaded = notification.userInfo?.optionalDictionaryForKey(KeyPageMap),
let pageType = pagesToListenFor()?.first(where: { (pageTypeListened) -> Bool in
guard let page = pagesLoaded.optionalDictionaryForKey(pageTypeListened),
let pageType = page.optionalStringForKey(KeyPageType),
pageType == pageTypeListened else { return false }
return true
}) {
newData = true
loadObject?.pageJSON = pagesLoaded.optionalDictionaryForKey(pageType)
}
// Checks for modules we are listening for.
if let modulesLoaded = notification.userInfo?.optionalDictionaryForKey(KeyModuleMap),
let modulesListened = modulesToListenFor() {
for moduleName in modulesListened {
if let module = modulesLoaded.optionalDictionaryForKey(moduleName) {
newData = true
var currentModules = loadObject?.modulesJSON ?? [:]
currentModules.updateValue(module, forKey: moduleName)
loadObject?.modulesJSON = currentModules
}
}
}
guard newData else { return }
do {
try parsePageJSON()
MVMCoreDispatchUtility.performBlock(onMainThread: {
self.handleNewDataAndUpdateUI()
})
} catch {
if let coreError = MVMCoreErrorObject.createErrorObject(for: error, location: "updateJSON for pageType: \(String(describing: pageType))") {
MVMCoreLoggingHandler.shared()?.addError(toLog: coreError)
}
}
}
open func shouldFinishProcessingLoad(_ loadObject: MVMCoreLoadObject, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject>) -> Bool {
pageType = loadObject.pageType
self.loadObject = loadObject
// Verifies all modules needed are loaded.
guard MFViewController.verifyRequiredModulesLoaded(for: loadObject, error: error) else { return false }
// Parse the model for the page.
do {
try parsePageJSON()
return true
} catch let parsingError {
// Log all parsing errors and fail load.
if let errorObject = MVMCoreErrorObject.createErrorObject(for: parsingError, location: MVMCoreLoadHandler.sharedGlobal()?.errorLocation(forRequest: loadObject)) {
@ -29,15 +120,12 @@ import UIKit
}
return false
}
// Verifies all modules needed are loaded.
return MFViewController.verifyRequiredModulesLoaded(for: loadObject, error: error)
}
@objc func parsePageJSON() throws {
open func parsePageJSON() throws {
}
public class func verifyRequiredModulesLoaded(for loadObject: MVMCoreLoadObject?, error: inout MVMCoreErrorObject?) -> Bool {
open class func verifyRequiredModulesLoaded(for loadObject: MVMCoreLoadObject?, error: inout MVMCoreErrorObject?) -> Bool {
guard let pageType = loadObject?.pageType, var modulesRequired = MVMCoreUIViewControllerMappingObject.shared()?.modulesRequired(forPageType: pageType) else { return true }
guard let loadedModules = loadObject?.modulesJSON else { return false }
@ -58,17 +146,28 @@ import UIKit
return true
}
open func setNavigationItem() {
open func set(navigationItem: UINavigationItem) {
navigationItem.title = pageModel?.screenHeading
navigationItem.accessibilityLabel = pageModel?.screenHeading
}
open func newDataBuildScreen() {
// TODO atomize the navigation item
setNavigationItem()
/// Calls processNewData and then sets the ui to update with updateView
open func handleNewDataAndUpdateUI() {
handleNewData()
self.needsUpdateUI = true
self.view.setNeedsLayout()
}
/// Processes any new data. Called after the page is loaded the first time and on response updates for this page,
open func handleNewData() {
// TODO atomize the navigation item
set(navigationItem: navigationItem)
formValidator?.validate()
}
// MARK: - View lifecycle
open func initialLoad() {
observeForResponseJSONUpdates()
}
open func updateViews() {
@ -78,5 +177,166 @@ import UIKit
super.viewDidLoad()
// Do any additional setup after loading the view.
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "View Controller Loaded : \(self)")
viewRespectsSystemMinimumLayoutMargins = false
// Presents from the bottom.
modalPresentationStyle = MVMCoreGetterUtility.isOnIPad() ? UIModalPresentationStyle.formSheet : UIModalPresentationStyle.overCurrentContext
// Do some initial loading.
if !initialLoadFinished {
initialLoadFinished = true
initialLoad()
}
// Handle data on load
handleNewData()
view.setNeedsLayout()
}
open override func viewDidLayoutSubviews() {
// Add to fix a constraint bug where the width is zero and things get messed up.
guard isViewLoaded,
view.bounds.width > 1 else {
super.viewDidLayoutSubviews()
return
}
if needsUpdateUI || screenSizeChanged() {
updateViews()
needsUpdateUI = false
}
super.viewDidLayoutSubviews()
}
open override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Update the navigation bar ui when view is appearing unless in a manager. The manager is expected to handle.
if manager == nil {
set(navigationItem: navigationItem)
}
}
open override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if manager == nil {
MVMCoreUISession.sharedGlobal()?.currentPageType = pageType
MVMCoreUILoggingHandler.shared()?.defaultLogPageState(forController: self)
}
}
deinit {
stopObservingForResponseJSONUpdates()
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "View Controller Deallocated : \(self)")
}
open override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return MVMCoreGetterUtility.isOnIPad() ? UIInterfaceOrientationMask.all : UIInterfaceOrientationMask.portrait
}
open override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
// Updates the detail view width
coordinator.animate(alongsideTransition: { (UIViewControllerTransitionCoordinatorContext) in
}) { (UIViewControllerTransitionCoordinatorContext) in
self.view.setNeedsLayout()
}
}
// MARK: - MVMCoreViewManagerViewControllerProtocol
open func viewControllerReady(inManager manager: UIViewController & MVMCoreViewManagerProtocol) {
if initialLoadFinished {
set(navigationItem: manager.navigationItem)
}
MVMCoreUISession.sharedGlobal()?.currentPageType = pageType
MVMCoreUILoggingHandler.shared()?.defaultLogPageState(forController: self)
}
// MARK: - MVMCoreActionDelegateProtocol
open func handleOpenPage(for requestParameters: MVMCoreRequestParameters, actionInformation: [AnyHashable : Any]?, additionalData: [AnyHashable : Any]?) {
formValidator?.addFormParams(requestParameters: requestParameters)
requestParameters.parentPageType = loadObject?.pageJSON?.optionalStringForKey("parentPageType")
MVMCoreActionHandler.defaultHandleOpenPage(for: requestParameters, additionalData: additionalData, delegateObject: selfDelegateObject)
}
// MARK: - MoleculeDelegateProtocol
open func getModuleWithName(_ name: String?) -> [AnyHashable : Any]? {
guard let name = name else { return nil }
return loadObject?.modulesJSON?.optionalDictionaryForKey(name)
}
open func getModuleWithName(_ moleculeName: String) -> MoleculeModelProtocol? {
guard let moduleJSON = loadObject?.modulesJSON?.optionalDictionaryForKey(moleculeName),
let moleculeName = moduleJSON.optionalStringForKey("moleculeName"),
let modelType = ModelRegistry.getType(for: moleculeName, with: MoleculeModelProtocol.self)
else { return nil }
do {
return try modelType.decode(jsonDict: moduleJSON) as? MoleculeModelProtocol
} catch {
MVMCoreUILoggingHandler.logDebugMessage(withDelegate: "error: \(error)")
}
return nil
}
// Test to see if needed.
open func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) {
}
open func addMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], sender: UITableViewCell, animation: UITableView.RowAnimation) {
}
open func removeMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], sender: UITableViewCell, animation: UITableView.RowAnimation) {
}
// MARK: - UITextFieldDelegate (Check if this is still needed)
// To Remove TextFields Bug: Keyboard is not dismissing after reaching textfield max length limit
open func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
open func textFieldDidBeginEditing(_ textField: UITextField) {
selectedField = textField
// TODO: Make this into a protocol
if UIAccessibility.isVoiceOverRunning {
if let toolBar = textField.inputAccessoryView as? UIToolbar, let _ = toolBar.items?.last, let pickerView = textField.inputView as? UIPickerView {
view.accessibilityElements = [pickerView, toolBar]
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
UIAccessibility.post(notification: UIAccessibility.Notification.layoutChanged, argument: textField.inputView)
}
}
}
open func textFieldDidEndEditing(_ textField: UITextField, reason: UITextField.DidEndEditingReason) {
if textField === selectedField {
if UIAccessibility.isVoiceOverRunning {
view.accessibilityElements = nil
UIAccessibility.post(notification: UIAccessibility.Notification.layoutChanged, argument: textField)
}
selectedField = nil
}
}
@objc open func dismissFieldInput(sender: Any?) {
selectedField?.resignFirstResponder()
}
// MARK: - UITextViewDelegate (Check if this is still needed)
open func textViewDidBeginEditing(_ textView: UITextView) {
selectedField = textView
}
open func textViewDidEndEditing(_ textView: UITextView) {
if textView === selectedField {
selectedField = nil
}
}
}

View File

@ -227,7 +227,7 @@
self.selectedIndex = i;
[tabbar selectIndex:self.selectedIndex animated:NO];
if ([self.viewController respondsToSelector:@selector(shouldCacheInManager)] && [((UIViewController <MVMCoreViewManagerViewControllerProtocol> *)self.viewController) shouldCacheInManager]) {
if (![self.viewController respondsToSelector:@selector(shouldCacheInManager)] || [((UIViewController <MVMCoreViewManagerViewControllerProtocol> *)self.viewController) shouldCacheInManager]) {
[viewControllers addObject:self.viewController];
} else {
[viewControllers addObject:[NSNull null]];

View File

@ -12,6 +12,4 @@ import Foundation
//Protocol for Validation
public protocol FormHolderProtocol: NSObjectProtocol {
var formValidator: FormValidator? { get set }
/// Should call formValidator's validate method
func validate()
}

View File

@ -1,5 +1,5 @@
//
// ProgrammaticScrollViewController.h
// MFProgrammaticScrollViewController.h
// myverizon
//
// Created by Scott Pfeil on 1/26/16.
@ -8,7 +8,7 @@
#import <MVMCoreUI/MFScrollingViewController.h>
@interface ProgrammaticScrollViewController : MFScrollingViewController
@interface MFProgrammaticScrollViewController : MFScrollingViewController
@end

View File

@ -1,21 +1,21 @@
//
// ProgrammaticScrollViewController.m
// MFProgrammaticScrollViewController.m
// myverizon
//
// Created by Scott Pfeil on 1/26/16.
// Copyright © 2016 Verizon Wireless. All rights reserved.
//
#import "ProgrammaticScrollViewController.h"
#import "MFProgrammaticScrollViewController.h"
@import MVMCore.NSDictionary_MFConvenience;
#import "NSLayoutConstraint+MFConvenience.h"
#import "MVMCoreUICommonViewsUtility.h"
@interface ProgrammaticScrollViewController ()
@interface MFProgrammaticScrollViewController ()
@end
@implementation ProgrammaticScrollViewController
@implementation MFProgrammaticScrollViewController
- (void)loadView {

View File

@ -6,9 +6,9 @@
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
#import <MVMCoreUI/ProgrammaticScrollViewController.h>
#import <MVMCoreUI/MFProgrammaticScrollViewController.h>
@interface MVMCoreUIStackableViewController : ProgrammaticScrollViewController
@interface MVMCoreUIStackableViewController : MFProgrammaticScrollViewController
// An array of ui elements that will be spaced out on the screen top to bottom from index 0 to formUIArray.count.
@property (nullable, strong, nonatomic) NSArray *formUIArray;

View File

@ -48,7 +48,7 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[];
#pragma mark - BaseControllers
#import <MVMCoreUI/MFViewController.h>
#import <MVMCoreUI/MFScrollingViewController.h>
#import <MVMCoreUI/ProgrammaticScrollViewController.h>
#import <MVMCoreUI/MFProgrammaticScrollViewController.h>
#import <MVMCoreUI/MFProgrammaticTableViewController.h>
#import <MVMCoreUI/MVMCoreUIStackableViewController.h>
#import <MVMCoreUI/StackableViewController.h>

View File

@ -13,4 +13,5 @@ public protocol PageModelProtocol {
var pageType: String { get set }
var screenHeading: String? { get set }
var isAtomicTabs: Bool? { get set }
var navigationItem: NavigationItemModelProtocol? { get set }
}

View File

@ -29,15 +29,14 @@ import UIKit
guard newValue != oldValue,
let self = self,
let index = self.dropDown.pickerData.firstIndex(of: newValue),
let dropListItemJSON = (self.listItemModel as? DropDownListItemModel).toJSON(),
let json2d = dropListItemJSON.optionalArrayForKey("molecules") as? [[[AnyHashable: Any]]]
let molecules2D = (self.listItemModel as? DropDownListItemModel)?.molecules
else { return }
if self.previousIndex != NSNotFound {
self.delegateObject?.moleculeDelegate?.removeMolecules(json2d[self.previousIndex], sender: self, animation: .fade)
self.delegateObject?.moleculeDelegate?.removeMolecules(molecules2D[self.previousIndex], sender: self, animation: .fade)
}
self.delegateObject?.moleculeDelegate?.addMolecules(json2d[index], sender: self, animation: .fade)
self.delegateObject?.moleculeDelegate?.addMolecules(molecules2D[index], sender: self, animation: .fade)
self.previousIndex = index
}
}

View File

@ -0,0 +1,17 @@
//
// NavigationItemModelProtocol.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 3/12/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
public protocol NavigationItemModelProtocol: ModelProtocol {
}
public protocol NavigationItemButtonModelProtocol {
}

View File

@ -14,11 +14,11 @@ NS_ASSUME_NONNULL_BEGIN
@interface MVMCoreUILoggingHandler : MVMCoreLoggingHandler
// Page State Logging
- (void)defaultLogPageStateForController:(nonnull MFViewController *)controller;
- (void)defaultLogPageStateForController:(nonnull id <MVMCoreViewControllerProtocol>)controller;
// Action Logging
- (void)defaultLogActionForController:(nonnull MFViewController *)controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData;
- (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull MFViewController *)controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData;
- (void)defaultLogActionForController:(nonnull id <MVMCoreViewControllerProtocol>)controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData;
- (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull id <MVMCoreViewControllerProtocol>)controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData;
@end

View File

@ -10,13 +10,13 @@
@implementation MVMCoreUILoggingHandler
- (void)defaultLogPageStateForController:(nonnull MFViewController *)controller {
- (void)defaultLogPageStateForController:(nonnull id <MVMCoreViewControllerProtocol>)controller {
}
- (void)defaultLogActionForController:(nonnull MFViewController *)controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData {
- (void)defaultLogActionForController:(nonnull id <MVMCoreViewControllerProtocol>)controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData {
}
- (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull MFViewController *)controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData {
- (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull id <MVMCoreViewControllerProtocol>)controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData {
return nil;
}

View File

@ -22,6 +22,7 @@ import Foundation
public var pageType: String
public var screenHeading: String?
public var isAtomicTabs: Bool?
public var navigationItem: NavigationItemModelProtocol?
public var header: MoleculeModelProtocol?
public var molecules: [ListItemModelProtocol & MoleculeModelProtocol]?

View File

@ -10,11 +10,13 @@ import UIKit
open class ModalMoleculeListTemplate: MoleculeListTemplate {
override open func newDataBuildScreen() {
super.newDataBuildScreen()
override open func handleNewData() {
MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: {[weak self] _ in
self?.dismiss()
if let _ = self {
MVMCoreNavigationHandler.shared()?.removeCurrentViewController()
}
}, verticalCentered: false)
super.handleNewData()
}
}

View File

@ -10,10 +10,12 @@ import UIKit
open class ModalMoleculeStackTemplate: MoleculeStackTemplate {
override open func newDataBuildScreen() {
super.newDataBuildScreen()
override open func handleNewData() {
super.handleNewData()
MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: {[weak self] _ in
self?.dismiss()
if let _ = self {
MVMCoreNavigationHandler.shared()?.removeCurrentViewController()
}
}, verticalCentered: false)
}

View File

@ -12,12 +12,6 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
//--------------------------------------------------
// MARK: - Stored Properties
//--------------------------------------------------
public var formValidator: FormValidator?
public func validate() {
// Can override
}
public var moleculesInfo: [(identifier: String, class: AnyClass, molecule: (ListItemModelProtocol & MoleculeModelProtocol))]?
var observer: NSKeyValueObservation?
@ -27,13 +21,8 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
//--------------------------------------------------
// MARK: - Computed Properties
//--------------------------------------------------
open override func parsePageJSON(_ error: NSErrorPointer) {
do {
try parseTemplateJSON()
} catch let parseError {
error?.pointee = parseError as NSError
}
open override func parsePageJSON() throws {
try parseTemplateJSON()
}
open override var loadObject: MVMCoreLoadObject? {
@ -90,10 +79,10 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
return true
}
open override func newDataBuildScreen() {
super.newDataBuildScreen()
open override func handleNewData() {
setup()
registerWithTable()
super.handleNewData()
}
//--------------------------------------------------
@ -109,7 +98,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
}
}
open override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
open func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
guard let moleculeInfo = moleculesInfo?[indexPath.row],
let estimatedHeight = (moleculeInfo.class as? ModelMoleculeViewProtocol.Type)?.estimatedHeight(with: moleculeInfo.molecule, delegateObject() as? MVMCoreUIDelegateObject)
else { return 0 }
@ -127,47 +116,33 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
let cell = tableView.dequeueReusableCell(withIdentifier: moleculeInfo.identifier)
else { return UITableViewCell() }
let delegate = delegateObject() as? MVMCoreUIDelegateObject
let moleculeCell = cell as? MVMCoreUIMoleculeViewProtocol
moleculeCell?.reset?()
if let protocolCell = cell as? MoleculeListCellProtocol {
protocolCell.setLines(with: templateModel?.line, delegateObject: delegate, additionalData: nil, indexPath: indexPath)
protocolCell.setLines(with: templateModel?.line, delegateObject: selfDelegateObject, additionalData: nil, indexPath: indexPath)
}
(moleculeCell as? ModelMoleculeViewProtocol)?.set(with: moleculeInfo.molecule, delegate, nil)
(moleculeCell as? ModelMoleculeViewProtocol)?.set(with: moleculeInfo.molecule, selfDelegateObject, nil)
moleculeCell?.updateView(tableView.bounds.width)
return cell
}
open override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
open func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if let protocolCell = cell as? MoleculeListCellProtocol {
protocolCell.willDisplay()
}
}
open override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if let cell = tableView.cellForRow(at: indexPath) as? MoleculeListCellProtocol {
cell.didSelectCell(at: indexPath, delegateObject: delegateObject() as? MVMCoreUIDelegateObject, additionalData: nil)
}
}
//--------------------------------------------------
// MARK: - Cache Handling
//--------------------------------------------------
open override func pageTypesToListenFor() -> [Any]? {
guard let pageType = self.pageType else { return super.pageTypesToListenFor() }
return [pageType]
}
open override func modulesToListenFor() -> [Any]? {
return loadObject?.requestParameters?.modules
}
//--------------------------------------------------
// MARK: - MoleculeDelegateProtocol
//--------------------------------------------------
@ -183,7 +158,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
}
}
public override func addMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {
public func addMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {
var tmpMolecules = [ListItemModelProtocol & MoleculeModelProtocol]()
@ -212,7 +187,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
}
}
public override func removeMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {
public func removeMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {
var tmpMolecules = [ListItemModelProtocol & MoleculeModelProtocol]()
@ -240,7 +215,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
view.layoutIfNeeded()
}
public func addMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], sender: UITableViewCell, animation: UITableView.RowAnimation) {
open override func addMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], sender: UITableViewCell, animation: UITableView.RowAnimation) {
// This dispatch is needed to fix a race condition that can occur if this function is called during the table setup.
DispatchQueue.main.async {
@ -262,7 +237,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
}
}
public func removeMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], sender: UITableViewCell, animation: UITableView.RowAnimation) {
open override func removeMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], sender: UITableViewCell, animation: UITableView.RowAnimation) {
var indexPaths: [IndexPath] = []
//TODO: cehck for molecule protocola eqality

View File

@ -9,20 +9,11 @@
import UIKit
open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol {
public func validate() {
}
public var formValidator: FormValidator?
var observer: NSKeyValueObservation?
public var templateModel: StackPageTemplateModel?
open override func parsePageJSON(_ error: NSErrorPointer) {
do {
try parseTemplateJSON()
} catch let parseError {
error?.pointee = parseError as NSError
}
open override func parsePageJSON() throws {
try parseTemplateJSON()
}
open override var loadObject: MVMCoreLoadObject? {
@ -73,17 +64,7 @@ open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol {
}
// MARK: - cache handling
open override func pageTypesToListenFor() -> [Any]? {
guard let pageType = self.pageType else {
return super.pageTypesToListenFor()
}
return [pageType]
}
open override func modulesToListenFor() -> [Any]? {
return loadObject?.requestParameters?.modules
}
/// Adds modules from requiredModules() to the MVMCoreViewControllerMapping.requiredModules map.
open func updateRequiredModules() {
if let requiredModules = requiredModules(), let pageType = pageType {

View File

@ -17,6 +17,7 @@ import Foundation
public var pageType: String
public var screenHeading: String?
public var isAtomicTabs: Bool?
public var navigationItem: NavigationItemModelProtocol?
public init(pageType: String) {
self.pageType = pageType

View File

@ -18,6 +18,7 @@ import Foundation
public var pageType: String
public var screenHeading: String?
public var isAtomicTabs: Bool?
public var navigationItem: NavigationItemModelProtocol?
public var header: MoleculeModelProtocol?
public var moleculeStack: MoleculeStackModel

View File

@ -14,7 +14,7 @@ public protocol TemplateProtocol: FormHolderProtocol {
var templateModel: TemplateModel? { get set }
}
public extension TemplateProtocol where Self: MFViewController {
public extension TemplateProtocol where Self: ViewController {
func parseTemplateJSON() throws {
guard let pageJSON = self.loadObject?.pageJSON else { return }
let data = try JSONSerialization.data(withJSONObject: pageJSON)

View File

@ -18,6 +18,7 @@ import Foundation
public var pageType: String
public var screenHeading: String?
public var isAtomicTabs: Bool?
public var navigationItem: NavigationItemModelProtocol?
public var header: MoleculeModelProtocol?
public var middle: MoleculeModelProtocol?

View File

@ -12,17 +12,10 @@ import UIKit
public func validate() {
}
public var formValidator: FormValidator?
public var templateModel: ThreeLayerPageTemplateModel?
open override func parsePageJSON(_ error: NSErrorPointer) {
do {
try parseTemplateJSON()
} catch let parseError {
error?.pointee = parseError as NSError
}
open override func parsePageJSON() throws {
try parseTemplateJSON()
}
override open func viewDidLoad() {
@ -31,8 +24,8 @@ import UIKit
// Do any additional setup after loading the view.
}
open override func newDataBuildScreen() {
super.newDataBuildScreen()
open override func handleNewData() {
super.handleNewData()
heightConstraint?.isActive = true
}