Line to swift
This commit is contained in:
parent
82f94cde25
commit
c96f5050a8
@ -33,6 +33,7 @@
|
|||||||
9455B19C234F8A0400A574DB /* MVMAnimationFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9455B19B234F8A0400A574DB /* MVMAnimationFramework.framework */; };
|
9455B19C234F8A0400A574DB /* MVMAnimationFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9455B19B234F8A0400A574DB /* MVMAnimationFramework.framework */; };
|
||||||
948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 948DB67D2326DCD90011F916 /* MultiProgress.swift */; };
|
948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 948DB67D2326DCD90011F916 /* MultiProgress.swift */; };
|
||||||
D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */; };
|
D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */; };
|
||||||
|
D213347723843825008E41B3 /* Line.swift in Sources */ = {isa = PBXBuildFile; fileRef = D213347623843825008E41B3 /* Line.swift */; };
|
||||||
D224798A2314445E003FCCF9 /* LabelSwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22479892314445E003FCCF9 /* LabelSwitch.swift */; };
|
D224798A2314445E003FCCF9 /* LabelSwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22479892314445E003FCCF9 /* LabelSwitch.swift */; };
|
||||||
D224798C231450C8003FCCF9 /* HeadlineBodySwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = D224798B231450C8003FCCF9 /* HeadlineBodySwitch.swift */; };
|
D224798C231450C8003FCCF9 /* HeadlineBodySwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = D224798B231450C8003FCCF9 /* HeadlineBodySwitch.swift */; };
|
||||||
D22479942316AE5E003FCCF9 /* NSLayoutConstraintExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22479932316AE5E003FCCF9 /* NSLayoutConstraintExtension.swift */; };
|
D22479942316AE5E003FCCF9 /* NSLayoutConstraintExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22479932316AE5E003FCCF9 /* NSLayoutConstraintExtension.swift */; };
|
||||||
@ -229,6 +230,7 @@
|
|||||||
9455B19B234F8A0400A574DB /* MVMAnimationFramework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MVMAnimationFramework.framework; path = ../SharedFrameworks/MVMAnimationFramework.framework; sourceTree = "<group>"; };
|
9455B19B234F8A0400A574DB /* MVMAnimationFramework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MVMAnimationFramework.framework; path = ../SharedFrameworks/MVMAnimationFramework.framework; sourceTree = "<group>"; };
|
||||||
948DB67D2326DCD90011F916 /* MultiProgress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiProgress.swift; sourceTree = "<group>"; };
|
948DB67D2326DCD90011F916 /* MultiProgress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiProgress.swift; sourceTree = "<group>"; };
|
||||||
D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoButtonView.swift; sourceTree = "<group>"; };
|
D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoButtonView.swift; sourceTree = "<group>"; };
|
||||||
|
D213347623843825008E41B3 /* Line.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Line.swift; sourceTree = "<group>"; };
|
||||||
D22479892314445E003FCCF9 /* LabelSwitch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelSwitch.swift; sourceTree = "<group>"; };
|
D22479892314445E003FCCF9 /* LabelSwitch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelSwitch.swift; sourceTree = "<group>"; };
|
||||||
D224798B231450C8003FCCF9 /* HeadlineBodySwitch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodySwitch.swift; sourceTree = "<group>"; };
|
D224798B231450C8003FCCF9 /* HeadlineBodySwitch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodySwitch.swift; sourceTree = "<group>"; };
|
||||||
D22479932316AE5E003FCCF9 /* NSLayoutConstraintExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSLayoutConstraintExtension.swift; sourceTree = "<group>"; };
|
D22479932316AE5E003FCCF9 /* NSLayoutConstraintExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSLayoutConstraintExtension.swift; sourceTree = "<group>"; };
|
||||||
@ -443,6 +445,12 @@
|
|||||||
D213347523842FF5008E41B3 /* Views */ = {
|
D213347523842FF5008E41B3 /* Views */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
D29DF17E21E69E2E003B2FB9 /* MFView.h */,
|
||||||
|
D29DF17F21E69E2E003B2FB9 /* MFView.m */,
|
||||||
|
D29DF31E21ED0CBA003B2FB9 /* LabelView.h */,
|
||||||
|
D29DF31F21ED0CBA003B2FB9 /* LabelView.m */,
|
||||||
|
D29DF15921E697DA003B2FB9 /* SeparatorView.h */,
|
||||||
|
D29DF15A21E697DA003B2FB9 /* SeparatorView.m */,
|
||||||
);
|
);
|
||||||
path = Views;
|
path = Views;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -737,19 +745,14 @@
|
|||||||
DBC4391622442196001AB423 /* CaretView.swift */,
|
DBC4391622442196001AB423 /* CaretView.swift */,
|
||||||
DBC4391722442197001AB423 /* DashLine.swift */,
|
DBC4391722442197001AB423 /* DashLine.swift */,
|
||||||
DB06250A2293456500B72DD3 /* LeftRightLabelView.swift */,
|
DB06250A2293456500B72DD3 /* LeftRightLabelView.swift */,
|
||||||
D29DF17E21E69E2E003B2FB9 /* MFView.h */,
|
|
||||||
D29DF17F21E69E2E003B2FB9 /* MFView.m */,
|
|
||||||
D29DF31E21ED0CBA003B2FB9 /* LabelView.h */,
|
|
||||||
D29DF31F21ED0CBA003B2FB9 /* LabelView.m */,
|
|
||||||
D29DF28721E7AC2B003B2FB9 /* ViewConstrainingView.h */,
|
D29DF28721E7AC2B003B2FB9 /* ViewConstrainingView.h */,
|
||||||
D29DF28821E7AC2B003B2FB9 /* ViewConstrainingView.m */,
|
D29DF28821E7AC2B003B2FB9 /* ViewConstrainingView.m */,
|
||||||
D282AAB9224131D100C46919 /* MFTransparentGIFView.swift */,
|
D282AAB9224131D100C46919 /* MFTransparentGIFView.swift */,
|
||||||
D282AAB3223FDDAE00C46919 /* MFLoadImageView.swift */,
|
D282AAB3223FDDAE00C46919 /* MFLoadImageView.swift */,
|
||||||
|
D213347623843825008E41B3 /* Line.swift */,
|
||||||
D29DF2AD21E7B3A4003B2FB9 /* MFTextView.h */,
|
D29DF2AD21E7B3A4003B2FB9 /* MFTextView.h */,
|
||||||
D29DF2AB21E7B3A4003B2FB9 /* MFTextView.m */,
|
D29DF2AB21E7B3A4003B2FB9 /* MFTextView.m */,
|
||||||
D29DF2AC21E7B3A4003B2FB9 /* MFTextView.xib */,
|
D29DF2AC21E7B3A4003B2FB9 /* MFTextView.xib */,
|
||||||
D29DF15921E697DA003B2FB9 /* SeparatorView.h */,
|
|
||||||
D29DF15A21E697DA003B2FB9 /* SeparatorView.m */,
|
|
||||||
D29DF2B121E7B76C003B2FB9 /* MFLoadingSpinner.h */,
|
D29DF2B121E7B76C003B2FB9 /* MFLoadingSpinner.h */,
|
||||||
D29DF2B221E7B76D003B2FB9 /* MFLoadingSpinner.m */,
|
D29DF2B221E7B76D003B2FB9 /* MFLoadingSpinner.m */,
|
||||||
D29DF32321ED0DA2003B2FB9 /* TextButtonView.h */,
|
D29DF32321ED0DA2003B2FB9 /* TextButtonView.h */,
|
||||||
@ -1092,6 +1095,7 @@
|
|||||||
D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */,
|
D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */,
|
||||||
D29DF25421E6A177003B2FB9 /* MFMdnTextField.m in Sources */,
|
D29DF25421E6A177003B2FB9 /* MFMdnTextField.m in Sources */,
|
||||||
D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */,
|
D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */,
|
||||||
|
D213347723843825008E41B3 /* Line.swift in Sources */,
|
||||||
D2A514672213885800345BFB /* StandardHeaderView.swift in Sources */,
|
D2A514672213885800345BFB /* StandardHeaderView.swift in Sources */,
|
||||||
DBEFFA04225A829700230692 /* Label.swift in Sources */,
|
DBEFFA04225A829700230692 /* Label.swift in Sources */,
|
||||||
D2D6CD4022E78C1A00D701B8 /* Scroller.swift in Sources */,
|
D2D6CD4022E78C1A00D701B8 /* Scroller.swift in Sources */,
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
open class CaretView: MFView {
|
open class CaretView: View {
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
@ -26,7 +26,7 @@ open class CaretView: MFView {
|
|||||||
// MARK: - Initialization
|
// MARK: - Initialization
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|
||||||
@objc public init() {
|
@objc public override init() {
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ open class CaretView: MFView {
|
|||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|
||||||
// Default values for view.
|
// Default values for view.
|
||||||
@objc open override func setAsMolecule() {
|
@objc open func setAsMolecule() {
|
||||||
defaultState()
|
defaultState()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,12 +124,14 @@ open class CaretView: MFView {
|
|||||||
lineWidth = lineWidthValue
|
lineWidth = lineWidthValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
open override func needsToBeConstrained() -> Bool {
|
extension CaretView: MVMCoreUIViewConstrainingProtocol {
|
||||||
|
open func needsToBeConstrained() -> Bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func alignment() -> UIStackView.Alignment {
|
open func alignment() -> UIStackView.Alignment {
|
||||||
return UIStackView.Alignment.leading;
|
return UIStackView.Alignment.leading;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
import MVMCore
|
import MVMCore
|
||||||
|
|
||||||
|
|
||||||
open class DashLine: MFView {
|
open class DashLine: View {
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
@ -62,8 +62,7 @@ open class DashLine: MFView {
|
|||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|
||||||
// Default values for view.
|
// Default values for view.
|
||||||
@objc open override func setAsMolecule() {
|
@objc open func setAsMolecule() {
|
||||||
|
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
isHidden = false
|
isHidden = false
|
||||||
}
|
}
|
||||||
|
|||||||
113
MVMCoreUI/Atoms/Views/Line.swift
Normal file
113
MVMCoreUI/Atoms/Views/Line.swift
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
//
|
||||||
|
// Line.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Scott Pfeil on 11/19/19.
|
||||||
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
@objcMembers open class Line: View {
|
||||||
|
|
||||||
|
public var heightConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
|
public enum Style: String, Codable {
|
||||||
|
case standard
|
||||||
|
case thin
|
||||||
|
case medium
|
||||||
|
case heavy
|
||||||
|
case none
|
||||||
|
}
|
||||||
|
|
||||||
|
public var style = Style.standard {
|
||||||
|
didSet {
|
||||||
|
switch style {
|
||||||
|
case .standard:
|
||||||
|
heightConstraint?.constant = 1
|
||||||
|
backgroundColor = .mfSilver()
|
||||||
|
setNeedsLayout()
|
||||||
|
layoutIfNeeded()
|
||||||
|
case .thin:
|
||||||
|
heightConstraint?.constant = 1
|
||||||
|
backgroundColor = .black
|
||||||
|
setNeedsLayout()
|
||||||
|
layoutIfNeeded()
|
||||||
|
case .medium:
|
||||||
|
heightConstraint?.constant = 2
|
||||||
|
backgroundColor = .black
|
||||||
|
setNeedsLayout()
|
||||||
|
layoutIfNeeded()
|
||||||
|
case .heavy:
|
||||||
|
heightConstraint?.constant = 4
|
||||||
|
backgroundColor = .black
|
||||||
|
setNeedsLayout()
|
||||||
|
layoutIfNeeded()
|
||||||
|
case .none:
|
||||||
|
heightConstraint?.constant = 0
|
||||||
|
setNeedsLayout()
|
||||||
|
layoutIfNeeded()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Helpers
|
||||||
|
open func shouldBeVisible() -> Bool {
|
||||||
|
guard let type = json?.optionalStringForKey(KeyType) else { return false }
|
||||||
|
return type != "none"
|
||||||
|
}
|
||||||
|
|
||||||
|
public convenience init(pinTo view: UIView, edge: UIRectEdge, useMargin: Bool) {
|
||||||
|
self.init(frame: .zero)
|
||||||
|
view.addSubview(self)
|
||||||
|
NSLayoutConstraint.activate(Array(NSLayoutConstraint.pinView(toSuperview: self, useMargins: useMargin, pinTop: edge != .bottom, pinBottom: edge != .top, pinLeft: edge != .right, pinRight: edge != .left).values))
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - MVMCoreViewProtocol
|
||||||
|
open override func setupView() {
|
||||||
|
super.setupView()
|
||||||
|
backgroundColor = .black
|
||||||
|
heightConstraint = heightAnchor.constraint(equalToConstant: 1)
|
||||||
|
heightConstraint?.isActive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
|
open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||||
|
|
||||||
|
if let typeString = json?.optionalStringForKey(KeyType), let type = Style.init(rawValue: typeString) {
|
||||||
|
style = type
|
||||||
|
} else {
|
||||||
|
style = .standard
|
||||||
|
}
|
||||||
|
|
||||||
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func reset() {
|
||||||
|
style = .standard
|
||||||
|
}
|
||||||
|
|
||||||
|
open func copyBackgroundColor() -> Bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
|
guard let type = json?.optionalStringForKey(KeyType) else { return 0 }
|
||||||
|
switch type {
|
||||||
|
case "thin", "standard":
|
||||||
|
return 1
|
||||||
|
case "medium":
|
||||||
|
return 2
|
||||||
|
case "heavy":
|
||||||
|
return 4
|
||||||
|
default:
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Line: MVMCoreUIViewConstrainingProtocol {
|
||||||
|
open func needsToBeConstrained() -> Bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -34,7 +34,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objcMembers open class MultiProgress: MFView {
|
@objcMembers open class MultiProgress: View {
|
||||||
///passing value to progressList creates corresponding progress bars
|
///passing value to progressList creates corresponding progress bars
|
||||||
var progressList: Array<ProgressBarObject>? {
|
var progressList: Array<ProgressBarObject>? {
|
||||||
didSet {
|
didSet {
|
||||||
@ -49,7 +49,7 @@ import UIKit
|
|||||||
guard progressObject.progress > 0.0 else {
|
guard progressObject.progress > 0.0 else {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
let view = MFView(frame: .zero)
|
let view = UIView(frame: .zero)
|
||||||
view.translatesAutoresizingMaskIntoConstraints = false
|
view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
addSubview(view)
|
addSubview(view)
|
||||||
view.backgroundColor = progressObject.color
|
view.backgroundColor = progressObject.color
|
||||||
|
|||||||
@ -62,6 +62,8 @@ extern NSString * _Nonnull const ConstraintWidth;
|
|||||||
#pragma mark - With Margins
|
#pragma mark - With Margins
|
||||||
|
|
||||||
+ (nonnull NSDictionary <NSString *, NSLayoutConstraint *>*)pinViewToSuperview:(nonnull UIView *)subview useMargins:(BOOL)useMargins;
|
+ (nonnull NSDictionary <NSString *, NSLayoutConstraint *>*)pinViewToSuperview:(nonnull UIView *)subview useMargins:(BOOL)useMargins;
|
||||||
|
+ (nonnull NSDictionary <NSString *, NSLayoutConstraint *>*)pinViewToSuperview:(nonnull UIView *)subview useMargins:(BOOL)useMargins pinTop:(BOOL)pinTop pinBottom:(BOOL)pinBottom pinLeft:(BOOL)pinLeft pinRight:(BOOL)pinRight;
|
||||||
|
+ (nonnull NSDictionary <NSString *, NSLayoutConstraint *>*)pinViewToSuperview:(nonnull UIView *)subview useMargins:(BOOL)useMargins pinTop:(BOOL)pinTop topConstant:(CGFloat)topConstant pinBottom:(BOOL)pinBottom bottomConstant:(CGFloat)bottomConstant pinLeft:(BOOL)pinLeft leftConstant:(CGFloat)leftConstant pinRight:(BOOL)pinRight rightConstant:(CGFloat)rightConstant;
|
||||||
+ (nonnull NSLayoutConstraint *)pinViewTopToSuperview:(nonnull UIView *)view useMargins:(BOOL)useMargins constant:(CGFloat)constant;
|
+ (nonnull NSLayoutConstraint *)pinViewTopToSuperview:(nonnull UIView *)view useMargins:(BOOL)useMargins constant:(CGFloat)constant;
|
||||||
+ (nonnull NSLayoutConstraint *)pinViewLeftToSuperview:(nonnull UIView *)view useMargins:(BOOL)useMargins constant:(CGFloat)constant;
|
+ (nonnull NSLayoutConstraint *)pinViewLeftToSuperview:(nonnull UIView *)view useMargins:(BOOL)useMargins constant:(CGFloat)constant;
|
||||||
+ (nonnull NSLayoutConstraint *)pinViewRightToSuperview:(nonnull UIView *)view useMargins:(BOOL)useMargins constant:(CGFloat)constant;
|
+ (nonnull NSLayoutConstraint *)pinViewRightToSuperview:(nonnull UIView *)view useMargins:(BOOL)useMargins constant:(CGFloat)constant;
|
||||||
|
|||||||
@ -161,11 +161,28 @@ NSString *const ConstraintWidth = @"width";
|
|||||||
#pragma mark - With Margins
|
#pragma mark - With Margins
|
||||||
|
|
||||||
+ (nonnull NSDictionary *)pinViewToSuperview:(nonnull UIView *)subview useMargins:(BOOL)useMargins {
|
+ (nonnull NSDictionary *)pinViewToSuperview:(nonnull UIView *)subview useMargins:(BOOL)useMargins {
|
||||||
return @{ConstraintTop:[self pinViewTopToSuperview:subview useMargins:useMargins constant:0],
|
return [NSLayoutConstraint pinViewToSuperview:subview useMargins:useMargins pinTop:YES topConstant:0 pinBottom:YES bottomConstant:0 pinLeft:YES leftConstant:0 pinRight:YES rightConstant:0];
|
||||||
ConstraintLeading:[self pinViewLeftToSuperview:subview useMargins:useMargins constant:0],
|
}
|
||||||
ConstraintTrailing:[self pinViewRightToSuperview:subview useMargins:useMargins constant:0],
|
|
||||||
ConstraintBot:[self pinViewBottomToSuperview:subview useMargins:useMargins constant:0],
|
+ (nonnull NSDictionary *)pinViewToSuperview:(nonnull UIView *)subview useMargins:(BOOL)useMargins pinTop:(BOOL)pinTop pinBottom:(BOOL)pinBottom pinLeft:(BOOL)pinLeft pinRight:(BOOL)pinRight {
|
||||||
};
|
return [NSLayoutConstraint pinViewToSuperview:subview useMargins:useMargins pinTop:pinTop topConstant:0 pinBottom:pinBottom bottomConstant:0 pinLeft:pinLeft leftConstant:0 pinRight:pinRight rightConstant:0];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSDictionary *)pinViewToSuperview:(UIView *)subview useMargins:(BOOL)useMargins pinTop:(BOOL)pinTop topConstant:(CGFloat)topConstant pinBottom:(BOOL)pinBottom bottomConstant:(CGFloat)bottomConstant pinLeft:(BOOL)pinLeft leftConstant:(CGFloat)leftConstant pinRight:(BOOL)pinRight rightConstant:(CGFloat)rightConstant {
|
||||||
|
NSMutableDictionary *constraints = [[NSMutableDictionary alloc] init];
|
||||||
|
if (pinTop) {
|
||||||
|
[constraints setObject:[self pinViewTopToSuperview:subview useMargins:useMargins constant:topConstant] forKey:ConstraintTop];
|
||||||
|
}
|
||||||
|
if (pinLeft) {
|
||||||
|
[constraints setObject:[self pinViewLeftToSuperview:subview useMargins:useMargins constant:topConstant] forKey:ConstraintLeading];
|
||||||
|
}
|
||||||
|
if (pinRight) {
|
||||||
|
[constraints setObject:[self pinViewRightToSuperview:subview useMargins:useMargins constant:topConstant] forKey:ConstraintTrailing];
|
||||||
|
}
|
||||||
|
if (pinBottom) {
|
||||||
|
[constraints setObject:[self pinViewBottomToSuperview:subview useMargins:useMargins constant:topConstant] forKey:ConstraintBot];
|
||||||
|
}
|
||||||
|
return constraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSLayoutConstraint *)pinViewTopToSuperview:(UIView *)view useMargins:(BOOL)useMargins constant:(CGFloat)constant {
|
+ (NSLayoutConstraint *)pinViewTopToSuperview:(UIView *)view useMargins:(BOOL)useMargins constant:(CGFloat)constant {
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@objcMembers open class NavigationController: UINavigationController {
|
@objcMembers open class NavigationController: UINavigationController {
|
||||||
public var separatorView: SeparatorView?
|
public var separatorView: Line?
|
||||||
|
|
||||||
public static func navigationController() -> Self? {
|
public static func navigationController() -> Self? {
|
||||||
return MVMCoreActionUtility.initializerClassCheck(MVMCoreUISession.sharedGlobal()?.navigationController, classToVerify: self) as? Self
|
return MVMCoreActionUtility.initializerClassCheck(MVMCoreUISession.sharedGlobal()?.navigationController, classToVerify: self) as? Self
|
||||||
@ -28,8 +28,8 @@ import UIKit
|
|||||||
public static func setupNavigationController() -> Self? {
|
public static func setupNavigationController() -> Self? {
|
||||||
let navigationController = self.init()
|
let navigationController = self.init()
|
||||||
style(navigationController.navigationBar)
|
style(navigationController.navigationBar)
|
||||||
navigationController.separatorView = SeparatorView.separatorAdd(to: navigationController.navigationBar, position: SeparatorPositionBot, withHorizontalPadding: 0)
|
navigationController.separatorView = Line(pinTo: navigationController.navigationBar, edge: .bottom, useMargin: false)
|
||||||
navigationController.separatorView?.setAsLight()
|
navigationController.separatorView?.style = .standard
|
||||||
MVMCoreUISession.sharedGlobal()?.navigationController = navigationController
|
MVMCoreUISession.sharedGlobal()?.navigationController = navigationController
|
||||||
MVMCoreNavigationHandler.shared()?.viewControllerToPresentOn = navigationController
|
MVMCoreNavigationHandler.shared()?.viewControllerToPresentOn = navigationController
|
||||||
MVMCoreNavigationHandler.shared()?.navigationController = navigationController
|
MVMCoreNavigationHandler.shared()?.navigationController = navigationController
|
||||||
|
|||||||
@ -21,8 +21,8 @@ import UIKit
|
|||||||
private var caretViewHeightSizeObject: MFSizeObject?
|
private var caretViewHeightSizeObject: MFSizeObject?
|
||||||
|
|
||||||
// For separation between cells.
|
// For separation between cells.
|
||||||
public var topSeparatorView: SeparatorView?
|
public var topSeparatorView: Line?
|
||||||
public var bottomSeparatorView: SeparatorView?
|
public var bottomSeparatorView: Line?
|
||||||
public enum SeparatorFrequency: String {
|
public enum SeparatorFrequency: String {
|
||||||
case all
|
case all
|
||||||
case allExceptTop
|
case allExceptTop
|
||||||
@ -57,21 +57,22 @@ import UIKit
|
|||||||
open func styleStandard() {
|
open func styleStandard() {
|
||||||
topMarginPadding = 24
|
topMarginPadding = 24
|
||||||
bottomMarginPadding = 24
|
bottomMarginPadding = 24
|
||||||
bottomSeparatorView?.show()
|
topSeparatorView?.style = .none
|
||||||
bottomSeparatorView?.setAsLight()
|
bottomSeparatorView?.style = .standard
|
||||||
}
|
}
|
||||||
|
|
||||||
open func styleHeader() {
|
open func styleHeader() {
|
||||||
topMarginPadding = 48
|
topMarginPadding = 48
|
||||||
bottomMarginPadding = 16
|
bottomMarginPadding = 16
|
||||||
bottomSeparatorView?.show()
|
topSeparatorView?.style = .none
|
||||||
bottomSeparatorView?.setAsRegular()
|
bottomSeparatorView?.style = .thin
|
||||||
}
|
}
|
||||||
|
|
||||||
open func styleNone() {
|
open func styleNone() {
|
||||||
topMarginPadding = 0
|
topMarginPadding = 0
|
||||||
bottomMarginPadding = 0
|
bottomMarginPadding = 0
|
||||||
bottomSeparatorView?.hide()
|
topSeparatorView?.style = .none
|
||||||
|
bottomSeparatorView?.style = .none
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds the molecule to the view.
|
/// Adds the molecule to the view.
|
||||||
@ -111,23 +112,25 @@ import UIKit
|
|||||||
// MARK: - MFViewProtocol
|
// MARK: - MFViewProtocol
|
||||||
public func updateView(_ size: CGFloat) {
|
public func updateView(_ size: CGFloat) {
|
||||||
MFStyler.setMarginsFor(self, size: size, defaultHorizontal: updateViewHorizontalDefaults, top: topMarginPadding, bottom: bottomMarginPadding)
|
MFStyler.setMarginsFor(self, size: size, defaultHorizontal: updateViewHorizontalDefaults, top: topMarginPadding, bottom: bottomMarginPadding)
|
||||||
|
|
||||||
if accessoryView != nil {
|
if accessoryView != nil {
|
||||||
// Smaller left margin if accessory view.
|
// Smaller left margin if accessory view.
|
||||||
var margin = directionalLayoutMargins
|
var margin = directionalLayoutMargins
|
||||||
margin.trailing = 16
|
margin.trailing = 16
|
||||||
contentView.directionalLayoutMargins = margin
|
contentView.directionalLayoutMargins = margin
|
||||||
|
|
||||||
|
// Update caret automatically.
|
||||||
|
if let caretView = caretView, let widthObject = caretViewWidthSizeObject, let heightObject = caretViewHeightSizeObject {
|
||||||
|
caretView.frame = CGRect(x: 0, y: 0, width: widthObject.getValueBased(onSize: size), height: heightObject.getValueBased(onSize: size))
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
contentView.directionalLayoutMargins = directionalLayoutMargins
|
contentView.directionalLayoutMargins = directionalLayoutMargins
|
||||||
}
|
}
|
||||||
topSeparatorView?.setLeftAndRightPinConstant(directionalLayoutMargins.leading)
|
|
||||||
bottomSeparatorView?.setLeftAndRightPinConstant(directionalLayoutMargins.leading)
|
|
||||||
|
|
||||||
molecule?.updateView(size)
|
|
||||||
if let _ = accessoryView, let caretView = caretView, let widthObject = caretViewWidthSizeObject, let heightObject = caretViewHeightSizeObject {
|
|
||||||
caretView.frame = CGRect(x: 0, y: 0, width: widthObject.getValueBased(onSize: size), height: heightObject.getValueBased(onSize: size))
|
|
||||||
}
|
|
||||||
topSeparatorView?.updateView(size)
|
topSeparatorView?.updateView(size)
|
||||||
bottomSeparatorView?.updateView(size)
|
bottomSeparatorView?.updateView(size)
|
||||||
|
|
||||||
|
molecule?.updateView(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func setupView() {
|
public func setupView() {
|
||||||
@ -256,8 +259,8 @@ import UIKit
|
|||||||
setSeparatorFrequency(separatorFrequency, indexPath: indexPath)
|
setSeparatorFrequency(separatorFrequency, indexPath: indexPath)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
topSeparatorView?.hide()
|
topSeparatorView?.style = .standard
|
||||||
bottomSeparatorView?.setAsLight()
|
bottomSeparatorView?.style = .standard
|
||||||
setSeparatorFrequency(TableViewCell.SeparatorFrequency.allExceptTop, indexPath: indexPath)
|
setSeparatorFrequency(TableViewCell.SeparatorFrequency.allExceptTop, indexPath: indexPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -275,12 +278,22 @@ import UIKit
|
|||||||
// MARK: - Separator
|
// MARK: - Separator
|
||||||
open func addSeparatorsIfNeeded() {
|
open func addSeparatorsIfNeeded() {
|
||||||
if topSeparatorView == nil {
|
if topSeparatorView == nil {
|
||||||
topSeparatorView = SeparatorView.separatorAdd(to: self, position: SeparatorPositionTop)
|
let line = Line()
|
||||||
topSeparatorView?.hide()
|
line.style = .none
|
||||||
|
addSubview(line)
|
||||||
|
NSLayoutConstraint.pinViewTop(toSuperview: line, useMargins: false, constant: 0).isActive = true
|
||||||
|
NSLayoutConstraint.pinViewLeft(toSuperview: line, useMargins: true, constant: 0).isActive = true
|
||||||
|
NSLayoutConstraint.pinViewRight(toSuperview: line, useMargins: true, constant: 0).isActive = true
|
||||||
|
topSeparatorView = line
|
||||||
}
|
}
|
||||||
if bottomSeparatorView == nil {
|
if bottomSeparatorView == nil {
|
||||||
bottomSeparatorView = SeparatorView.separatorAdd(to: self, position: SeparatorPositionBot)
|
let line = Line()
|
||||||
bottomSeparatorView?.hide()
|
line.style = .none
|
||||||
|
addSubview(line)
|
||||||
|
NSLayoutConstraint.pinViewBottom(toSuperview: line, useMargins: false, constant: 0).isActive = true
|
||||||
|
NSLayoutConstraint.pinViewLeft(toSuperview: line, useMargins: true, constant: 0).isActive = true
|
||||||
|
NSLayoutConstraint.pinViewRight(toSuperview: line, useMargins: true, constant: 0).isActive = true
|
||||||
|
bottomSeparatorView = line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,26 +302,26 @@ import UIKit
|
|||||||
switch separatorFrequency {
|
switch separatorFrequency {
|
||||||
case .all:
|
case .all:
|
||||||
if indexPath.row == 0 {
|
if indexPath.row == 0 {
|
||||||
topSeparatorView?.show()
|
topSeparatorView?.isHidden = false
|
||||||
} else {
|
} else {
|
||||||
topSeparatorView?.hide()
|
topSeparatorView?.isHidden = true
|
||||||
}
|
}
|
||||||
bottomSeparatorView?.show()
|
bottomSeparatorView?.isHidden = false
|
||||||
case .allExceptBottom:
|
case .allExceptBottom:
|
||||||
topSeparatorView?.show()
|
topSeparatorView?.isHidden = false
|
||||||
bottomSeparatorView?.hide()
|
bottomSeparatorView?.isHidden = true
|
||||||
case .between:
|
case .between:
|
||||||
if indexPath.row == 0 {
|
if indexPath.row == 0 {
|
||||||
topSeparatorView?.hide()
|
topSeparatorView?.isHidden = true
|
||||||
} else {
|
} else {
|
||||||
topSeparatorView?.show()
|
topSeparatorView?.isHidden = false
|
||||||
}
|
}
|
||||||
bottomSeparatorView?.hide()
|
bottomSeparatorView?.isHidden = true
|
||||||
case .allExceptTop:
|
case .allExceptTop:
|
||||||
fallthrough
|
fallthrough
|
||||||
default:
|
default:
|
||||||
topSeparatorView?.hide()
|
topSeparatorView?.isHidden = true
|
||||||
bottomSeparatorView?.show()
|
bottomSeparatorView?.isHidden = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,12 +9,12 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public class StandardHeaderView: ViewConstrainingView {
|
public class StandardHeaderView: ViewConstrainingView {
|
||||||
var separatorView: SeparatorView?
|
var line: Line?
|
||||||
|
|
||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
open override func updateView(_ size: CGFloat) {
|
open override func updateView(_ size: CGFloat) {
|
||||||
super.updateView(size)
|
super.updateView(size)
|
||||||
separatorView?.updateView(size)
|
line?.updateView(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setupView() {
|
public override func setupView() {
|
||||||
@ -24,21 +24,12 @@ public class StandardHeaderView: ViewConstrainingView {
|
|||||||
updateViewHorizontalDefaults = true
|
updateViewHorizontalDefaults = true
|
||||||
topMarginPadding = PaddingDefaultVerticalSpacing
|
topMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
bottomMarginPadding = PaddingDefaultVerticalSpacing
|
bottomMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
if separatorView == nil, let separatorView = SeparatorView.separatorAdd(to: self, position: SeparatorPositionBot, withHorizontalPadding: 0) {
|
|
||||||
separatorView.setAsHeavy()
|
|
||||||
addSubview(separatorView)
|
|
||||||
self.separatorView = separatorView
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override func setLeftPinConstant(_ constant: CGFloat) {
|
guard line == nil else { return }
|
||||||
super.setLeftPinConstant(constant)
|
let line = Line(pinTo: self, edge: .bottom, useMargin: true)
|
||||||
separatorView?.leftPin?.constant = constant
|
line.style = .heavy
|
||||||
}
|
addSubview(line)
|
||||||
|
self.line = line
|
||||||
public override func setRightPinConstant(_ constant: CGFloat) {
|
|
||||||
super.setRightPinConstant(constant)
|
|
||||||
separatorView?.rightPin?.constant = constant
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
@ -50,7 +41,7 @@ public class StandardHeaderView: ViewConstrainingView {
|
|||||||
(molecule as? MVMCoreUIViewConstrainingProtocol)?.shouldSetVerticalMargins?(false)
|
(molecule as? MVMCoreUIViewConstrainingProtocol)?.shouldSetVerticalMargins?(false)
|
||||||
|
|
||||||
if let separatorJSON = json?.optionalDictionaryForKey("separator") {
|
if let separatorJSON = json?.optionalDictionaryForKey("separator") {
|
||||||
separatorView?.setWithJSON(separatorJSON, delegateObject: delegateObject, additionalData: additionalData)
|
line?.setWithJSON(separatorJSON, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,8 +49,7 @@ public class StandardHeaderView: ViewConstrainingView {
|
|||||||
super.reset()
|
super.reset()
|
||||||
topMarginPadding = PaddingDefaultVerticalSpacing
|
topMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
bottomMarginPadding = PaddingDefaultVerticalSpacing
|
bottomMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
separatorView?.setAsHeavy()
|
line?.style = .heavy
|
||||||
separatorView?.show()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
mapping = [@{
|
mapping = [@{
|
||||||
@"label": Label.class,
|
@"label": Label.class,
|
||||||
@"line": SeparatorView.class,
|
@"line": Line.class,
|
||||||
@"button": ButtonView.class,
|
@"button": ButtonView.class,
|
||||||
@"textButton": MFTextButton.class,
|
@"textButton": MFTextButton.class,
|
||||||
@"header": StandardHeaderView.class,
|
@"header": StandardHeaderView.class,
|
||||||
@ -43,7 +43,6 @@
|
|||||||
@"progressbar": ProgressBar.class,
|
@"progressbar": ProgressBar.class,
|
||||||
@"circleProgress": GraphView.class,
|
@"circleProgress": GraphView.class,
|
||||||
@"multiProgressBar": MultiProgress.class,
|
@"multiProgressBar": MultiProgress.class,
|
||||||
@"checkbox": MVMCoreUICheckBox.class,
|
|
||||||
@"radioButton": RadioButton.class,
|
@"radioButton": RadioButton.class,
|
||||||
@"radioButtonLabel": RadioButtonLabel.class,
|
@"radioButtonLabel": RadioButtonLabel.class,
|
||||||
@"listItem": MoleculeTableViewCell.class,
|
@"listItem": MoleculeTableViewCell.class,
|
||||||
|
|||||||
@ -76,14 +76,13 @@ open class MoleculeListTemplate: ThreeLayerTableViewController {
|
|||||||
return UITableViewCell()
|
return UITableViewCell()
|
||||||
}
|
}
|
||||||
let delegate = delegateObject() as? MVMCoreUIDelegateObject
|
let delegate = delegateObject() as? MVMCoreUIDelegateObject
|
||||||
|
let moleculeCell = cell as? MVMCoreUIMoleculeViewProtocol
|
||||||
|
moleculeCell?.reset?()
|
||||||
if let protocolCell = cell as? MoleculeListCellProtocol {
|
if let protocolCell = cell as? MoleculeListCellProtocol {
|
||||||
protocolCell.setSeparatorWithJSON?(loadObject?.pageJSON?.optionalDictionaryForKey("separator"), delegateObject: delegate, additionalData: nil, indexPath: indexPath)
|
protocolCell.setSeparatorWithJSON?(loadObject?.pageJSON?.optionalDictionaryForKey("separator"), delegateObject: delegate, additionalData: nil, indexPath: indexPath)
|
||||||
}
|
}
|
||||||
if let protocolCell = cell as? MVMCoreUIMoleculeViewProtocol {
|
moleculeCell?.setWithJSON(moleculeInfo.molecule, delegateObject: delegate, additionalData: nil)
|
||||||
protocolCell.reset?()
|
moleculeCell?.updateView(tableView.bounds.width)
|
||||||
protocolCell.setWithJSON(moleculeInfo.molecule, delegateObject: delegate, additionalData: nil)
|
|
||||||
protocolCell.updateView(tableView.bounds.width)
|
|
||||||
}
|
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user