This commit is contained in:
Pfeil, Scott Robert 2019-04-24 15:38:35 -04:00
commit dc1372ca40
19 changed files with 593 additions and 487 deletions

View File

@ -96,8 +96,6 @@
D29DF28021E7AA51003B2FB9 /* MVMCoreUIDetailViewProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF27F21E7AA50003B2FB9 /* MVMCoreUIDetailViewProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
D29DF28321E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF28121E7AB23003B2FB9 /* MVMCoreUICommonViewsUtility.m */; };
D29DF28421E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF28221E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.h */; settings = {ATTRIBUTES = (Public, ); }; };
D29DF28921E7AC2B003B2FB9 /* MFLabel.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF28521E7AC2B003B2FB9 /* MFLabel.h */; settings = {ATTRIBUTES = (Public, ); }; };
D29DF28A21E7AC2B003B2FB9 /* MFLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF28621E7AC2B003B2FB9 /* MFLabel.m */; };
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 */; };
@ -165,6 +163,7 @@
DBC4391922442197001AB423 /* DashLine.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBC4391722442197001AB423 /* DashLine.swift */; };
DBC4391B224421A0001AB423 /* CaretButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBC4391A224421A0001AB423 /* CaretButton.swift */; };
DBC4392122491730001AB423 /* LabelWithInternalButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBC4391C2245232D001AB423 /* LabelWithInternalButton.swift */; };
DBEFFA04225A829700230692 /* Label.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB891E822253FA8500022516 /* Label.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -266,8 +265,6 @@
D29DF27F21E7AA50003B2FB9 /* MVMCoreUIDetailViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIDetailViewProtocol.h; sourceTree = "<group>"; };
D29DF28121E7AB23003B2FB9 /* MVMCoreUICommonViewsUtility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUICommonViewsUtility.m; sourceTree = "<group>"; };
D29DF28221E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreUICommonViewsUtility.h; sourceTree = "<group>"; };
D29DF28521E7AC2B003B2FB9 /* MFLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFLabel.h; sourceTree = "<group>"; };
D29DF28621E7AC2B003B2FB9 /* MFLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFLabel.m; 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>"; };
@ -322,6 +319,7 @@
D2C5001621F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIViewControllerMappingObject.h; sourceTree = "<group>"; };
D2C5001721F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIViewControllerMappingObject.m; sourceTree = "<group>"; };
D2E1FADA2260D3D200AEFD8C /* MVMCoreUIDelegateObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreUIDelegateObject.swift; sourceTree = "<group>"; };
DB891E822253FA8500022516 /* Label.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Label.swift; sourceTree = "<group>"; };
D2E1FADC2268B25E00AEFD8C /* MoleculeTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeTableViewCell.swift; sourceTree = "<group>"; };
D2E1FADE2268B8E700AEFD8C /* ThreeLayerTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeLayerTableViewController.swift; sourceTree = "<group>"; };
D2E1FAE02268E81D00AEFD8C /* MoleculeListTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeListTemplate.swift; sourceTree = "<group>"; };
@ -573,8 +571,6 @@
DBC4391722442197001AB423 /* DashLine.swift */,
D29DF17E21E69E2E003B2FB9 /* MFView.h */,
D29DF17F21E69E2E003B2FB9 /* MFView.m */,
D29DF28521E7AC2B003B2FB9 /* MFLabel.h */,
D29DF28621E7AC2B003B2FB9 /* MFLabel.m */,
D29DF31E21ED0CBA003B2FB9 /* LabelView.h */,
D29DF31F21ED0CBA003B2FB9 /* LabelView.m */,
D29DF28721E7AC2B003B2FB9 /* ViewConstrainingView.h */,
@ -599,6 +595,7 @@
D22D1F44220496A30077CEC0 /* MVMCoreUISwitch.h */,
D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */,
DBC4391C2245232D001AB423 /* LabelWithInternalButton.swift */,
DB891E822253FA8500022516 /* Label.swift */,
0198F7A02256A80A0066C936 /* MFRadioButton.h */,
0198F7A22256A80A0066C936 /* MFRadioButton.m */,
);
@ -754,7 +751,6 @@
D29DF27521E79E81003B2FB9 /* MVMCoreUILoggingHandler.h in Headers */,
D29DF28B21E7AC2B003B2FB9 /* ViewConstrainingView.h in Headers */,
D29DF2B321E7B76D003B2FB9 /* MFLoadingSpinner.h in Headers */,
D29DF28921E7AC2B003B2FB9 /* MFLabel.h in Headers */,
D29DF32521ED0DA2003B2FB9 /* TextButtonView.h in Headers */,
D29DF25021E6A177003B2FB9 /* MFDigitTextBox.h in Headers */,
D29DF2C621E7BF57003B2FB9 /* MFTabBarInteractor.h in Headers */,
@ -900,6 +896,7 @@
D29DF25421E6A177003B2FB9 /* MFMdnTextField.m in Sources */,
D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */,
D2A514672213885800345BFB /* StandardHeaderView.swift in Sources */,
DBEFFA04225A829700230692 /* Label.swift in Sources */,
D29DF13021E6851E003B2FB9 /* MVMCoreUITopAlertShortView.m in Sources */,
D28B4F8B21FF967C00712C7A /* MVMCoreUIObject.m in Sources */,
D29DF26D21E6AA0B003B2FB9 /* FLAnimatedImageView.m in Sources */,
@ -914,7 +911,6 @@
D274CA332236A78900B01B62 /* StandardFooterView.swift in Sources */,
D29DF2BF21E7BEA4003B2FB9 /* MVMCoreUITabBarPageControlViewController.m in Sources */,
D29DF28321E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.m in Sources */,
D29DF28A21E7AC2B003B2FB9 /* MFLabel.m in Sources */,
D206997821FB8A0B00CAE0DE /* MVMCoreUINavigationController.m in Sources */,
D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */,
01DF55E021F8FAA800CC099B /* MFTextFieldListView.swift in Sources */,

View File

@ -8,7 +8,7 @@
//
open class CaretButton: MFCustomButton {
open class CaretButton: MFCustomButton, MVMCoreUIMoleculeViewProtocol {
//------------------------------------------------------
// MARK: - Constants
//------------------------------------------------------
@ -114,7 +114,7 @@ open class CaretButton: MFCustomButton {
setTitleColor(disabledColor, for: .disabled)
}
open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
@objc public func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
setWithActionMap(json, delegateObject: delegateObject, additionalData: additionalData)
guard let dictionary = json else { return }

View File

@ -11,7 +11,7 @@
@class PrimaryButton;
@class MFTextField;
@class MFLabel;
@class Label;
@protocol MFTextFieldDelegate <NSObject>
@ -34,7 +34,7 @@
@property (nullable, weak, nonatomic) IBOutlet UIView *textFieldContainerView;
@property (nullable, weak, nonatomic) IBOutlet UITextField *textField;
@property (nullable, weak, nonatomic) IBOutlet MFLabel *formLabel;
@property (nullable, weak, nonatomic) IBOutlet Label *formLabel;
@property (nullable, weak, nonatomic) IBOutlet UIView *separatorView;//make it public so outsider class can know the posistion of it.
@property (nullable, weak, nonatomic) IBOutlet NSLayoutConstraint *heightConstraint;

View File

@ -7,12 +7,10 @@
//
#import "MFTextField.h"
#import <MVMCoreUI/MVMCoreUI-Swift.h>
#import "MFTextFieldSubclassExtension.h"
#import "MFStyler.h"
#import "UIColor+MFConvenience.h"
#import "MVMCoreUICommonViewsUtility.h"
#import "MFLabel.h"
#import "MVMCoreUIUtility.h"
#import "MVMCoreUIConstants.h"
#import <MVMCoreUI/MVMCoreUI-Swift.h>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@ -98,7 +98,7 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8zH-YN-qag" customClass="MFLabel">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8zH-YN-qag" customClass="Label" customModule="MVMCoreUI" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="36"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>

View File

@ -0,0 +1,308 @@
//
// Label.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 3/22/17.
// Converted by Christiano, Kevin on 4/2/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import MVMCore
@objc open class Label: UILabel, MVMCoreViewProtocol, MVMCoreUIMoleculeViewProtocol {
//------------------------------------------------------
// MARK: - Properties
//------------------------------------------------------
// Set this property if you want updateView to update the font based on this standard and the size passed in.
@objc public var standardFontSize: CGFloat = 0.0
// Set this to use a custom sizing object during updateView instead of the standard.
@objc public var sizeObject: MFSizeObject?
@objc public var scaleSize: NSNumber?
// Used for scaling the font in updateView.
private var originalAttributedString: NSAttributedString?
@objc public var hasText: Bool {
guard let text = text, let attributedText = attributedText else { return false }
return !text.isEmpty || !attributedText.string.isEmpty
}
//------------------------------------------------------
// MARK: - Initialization
//------------------------------------------------------
@objc public func setupView() {
backgroundColor = .clear
numberOfLines = 0
lineBreakMode = .byWordWrapping
translatesAutoresizingMaskIntoConstraints = false
}
@objc public init() {
super.init(frame: .zero)
setupView()
}
@objc required public init?(coder: NSCoder) {
super.init(coder: coder)
setupView()
}
@objc override public init(frame: CGRect) {
super.init(frame: frame)
setupView()
}
@objc convenience public init(standardFontSize size: CGFloat) {
self.init()
standardFontSize = size
}
//------------------------------------------------------
// MARK: - Functions
//------------------------------------------------------
@objc public static func commonLabelH1(_ scale: Bool) -> Label {
let label = Label.label()
label.styleH1(scale)
return label
}
@objc public static func commonLabelH2(_ scale: Bool) -> Label {
let label = Label.label()
label.styleH2(scale)
return label
}
@objc public static func commonLabelH3(_ scale: Bool) -> Label {
let label = Label.label()
label.styleH3(scale)
return label
}
@objc public static func commonLabelH32(_ scale: Bool) -> Label {
let label = Label.label()
label.styleH32(scale)
return label
}
@objc public static func commonLabelB1(_ scale: Bool) -> Label {
let label = Label.label()
label.styleB1(scale)
return label
}
@objc public static func commonLabelB2(_ scale: Bool) -> Label {
let label = Label.label()
label.styleB2(scale)
return label
}
@objc public static func commonLabelB3(_ scale: Bool) -> Label {
let label = Label.label()
label.styleB3(scale)
return label
}
@objc public static func commonLabelB20(_ scale: Bool) -> Label {
let label = Label.label()
label.styleB20(scale)
return label
}
@objc open class func label() -> Label {
return Label(frame: .zero)
}
//------------------------------------------------------
// MARK: - Functions
//------------------------------------------------------
@objc public static func setLabel(_ label: UILabel?, withHTML html: String?) {
guard let data = html?.data(using: .utf8) else { return }
do {
label?.attributedText = try NSAttributedString(data: data,
options: [NSAttributedString.DocumentReadingOptionKey.documentType: NSAttributedString.DocumentType.html,
NSAttributedString.DocumentReadingOptionKey.characterEncoding: String.Encoding.utf8.rawValue],
documentAttributes: nil)
} catch {
if let coreErrorObject = MVMCoreErrorObject.createErrorObject(for: error, location: "LabelHTMLParse") {
MVMCoreUILoggingHandler.shared()?.addError(toLog: coreErrorObject)
}
}
}
@objc public static func setUILabel(_ label: UILabel?, withJSON json: [AnyHashable: Any]?, delegate: DelegateObject?, additionalData: [AnyHashable: Any]?) {
guard let label = label else { return }
label.text = json?.optionalStringForKey(KeyText)
setLabel(label, withHTML: json?.optionalStringForKey("html"))
if let textColorHex = json?.optionalStringForKey(KeyTextColor), !textColorHex.isEmpty {
label.textColor = UIColor.mfGet(forHex: textColorHex)
}
if let backgroundColorHex = json?.optionalStringForKey(KeyBackgroundColor), !backgroundColorHex.isEmpty {
label.backgroundColor = UIColor.mfGet(forHex: backgroundColorHex)
}
label.accessibilityLabel = json?.optionalStringForKey("accessibilityText")
let fontSize = json?["fontSize"] as? CGFloat
if let fontName = json?.optionalStringForKey("fontName") {
label.font = MFFonts.mfFont(withName: fontName, size: fontSize ?? label.font.pointSize)
} else if let fontSize = fontSize {
label.font = label.font.withSize(fontSize)
}
if let attributes = json?.arrayForKey("attributes"), let labelText = label.text {
let attributedString = NSMutableAttributedString(string: labelText, attributes: [NSAttributedString.Key.font: label.font as UIFont,
NSAttributedString.Key.foregroundColor: label.textColor as UIColor])
for case let attribute as [String: Any] in attributes {
guard let attributeType = attribute.optionalStringForKey(KeyType),
let location = attribute["location"] as? Int,
let length = attribute["length"] as? Int
else { continue }
let range = NSRange(location: location, length: length)
switch attributeType {
case "underline":
attributedString.addAttribute(.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: range)
case "strikethrough":
attributedString.addAttribute(.strikethroughStyle, value: NSUnderlineStyle.thick.rawValue, range: range)
case "color":
if let colorHex = attribute.optionalStringForKey(KeyTextColor), !colorHex.isEmpty {
attributedString.removeAttribute(.foregroundColor, range: range)
attributedString.addAttribute(.foregroundColor, value: UIColor.mfGet(forHex: colorHex), range: range)
}
case "font":
let fontSize = attribute["size"] as? CGFloat
var font: UIFont?
if let fontName = attribute.optionalStringForKey("name") {
font = MFFonts.mfFont(withName: fontName, size: fontSize ?? label.font.pointSize)
} else if let fontSize = fontSize {
font = label.font.withSize(fontSize)
}
if let font = font {
attributedString.removeAttribute(.font, range: range)
attributedString.addAttribute(.font, value: font, range: range)
}
default:
continue
}
}
label.attributedText = attributedString
}
}
//------------------------------------------------------
// MARK: - Methods
//------------------------------------------------------
@objc public func styleH1(_ scale: Bool) {
MFStyler.styleLabelH1(self, genericScaling: false)
setScale(scale)
}
@objc public func styleH2(_ scale: Bool) {
MFStyler.styleLabelH2(self, genericScaling: false)
setScale(scale)
}
@objc public func styleH3(_ scale: Bool) {
MFStyler.styleLabelH3(self, genericScaling: false)
setScale(scale)
}
@objc public func styleH32(_ scale: Bool) {
MFStyler.styleLabelH32(self, genericScaling: false)
setScale(scale)
}
@objc public func styleB1(_ scale: Bool) {
MFStyler.styleLabelB1(self, genericScaling: false)
setScale(scale)
}
@objc public func styleB2(_ scale: Bool) {
MFStyler.styleLabelB2(self, genericScaling: false)
setScale(scale)
}
@objc public func styleB3(_ scale: Bool) {
MFStyler.styleLabelB3(self, genericScaling: false)
setScale(scale)
}
@objc public func styleB20(_ scale: Bool) {
MFStyler.styleLabelB20(self, genericScaling: false)
setScale(scale)
}
@objc public func updateView(_ size: CGFloat) {
scaleSize = size as NSNumber
if let originalAttributedString = originalAttributedString {
let attributedString = NSMutableAttributedString(attributedString: originalAttributedString)
attributedString.removeAttribute(.font, range: NSRange(location: 0, length: attributedString.length))
originalAttributedString.enumerateAttribute(.font, in: NSRange(location: 0, length: originalAttributedString.length), options: [], using: { value, range, stop in
// Loop the original attributed string, resize the fonts.
if let fontObj = value as? UIFont, let stylerSize = MFStyler.sizeObjectGeneric(forCurrentDevice: fontObj.pointSize)?.getValueBased(onSize: size) {
attributedString.addAttribute(.font, value: fontObj.withSize(stylerSize) as Any, range: range)
}
})
attributedText = attributedString
} else if !MVMCoreGetterUtility.fequal(a: Float(standardFontSize), b: 0.0), let sizeObject: MFSizeObject = self.sizeObject ?? MFStyler.sizeObjectGeneric(forCurrentDevice: standardFontSize) {
self.font = self.font.withSize(sizeObject.getValueBased(onSize: size))
}
}
@objc public func setFont(_ font: UIFont, scale: Bool) {
self.font = font
setScale(scale)
}
@objc public func setScale(_ scale: Bool) {
if scale {
standardFontSize = font.pointSize
if let floatScale = scaleSize?.floatValue {
updateView(CGFloat(floatScale))
} else {
updateView(MVMCoreUISplitViewController.getApplicationViewWidth())
}
} else {
standardFontSize = 0
}
}
//------------------------------------------------------
// MARK: - Atomization
//------------------------------------------------------
@objc public func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
Label.setUILabel(self, withJSON: json, delegate: delegateObject, additionalData: additionalData)
originalAttributedString = attributedText
}
}
extension Label {
}

View File

@ -8,12 +8,12 @@
#import <UIKit/UIKit.h>
#import <MVMCoreUI/ViewConstrainingView.h>
#import <MVMCoreUI/MFLabel.h>
@class Label;
@interface LabelView : ViewConstrainingView
// Customize the label.
@property (nullable, weak, nonatomic) MFLabel *label;
@property (nullable, weak, nonatomic) Label *label;
// Change the alignment of the label
- (void)alignLeft;

View File

@ -8,6 +8,7 @@
#import <MVMCoreUI/LabelView.h>
#import "MFStyler.h"
#import <MVMCoreUI/MVMCoreUI-Swift.h>
@interface LabelView ()
// Change to customize.
@ -32,7 +33,7 @@
if (!self.label) {
self.backgroundColor = [UIColor clearColor];
MFLabel *label = [MFLabel commonLabelB2:YES];
Label *label = [Label commonLabelB2:YES];
[self addSubview:label];
self.label = label;

View File

@ -11,8 +11,8 @@ import MVMCore
public typealias ActionBlock = () -> Void
private typealias ActionableStringTuple = (front: String?, action: String?, end: String?)
public typealias ActionObjectDelegate = (NSObjectProtocol & MVMCoreActionDelegateProtocol)
public typealias ButtonObjectDelegate = (NSObjectProtocol & ButtonDelegateProtocol)
public typealias ActionObjectDelegate = NSObjectProtocol & MVMCoreActionDelegateProtocol
public typealias ButtonObjectDelegate = NSObjectProtocol & ButtonDelegateProtocol
public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProtocol & MVMCoreLoadDelegateProtocol & MVMCorePresentationDelegateProtocol & NSObjectProtocol
@ -22,7 +22,7 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
//------------------------------------------------------
public var actionBlock: ActionBlock?
public weak var label: MFLabel?
public weak var label: Label?
public var attributedText: NSAttributedString? {
willSet(newAttributedText) {
@ -62,6 +62,10 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
}
}
private var actionRange: NSRange {
return NSRange(location: frontText?.count ?? 0, length: actionText?.count ?? 0)
}
public var makeWholeViewClickable = false
override open var isEnabled: Bool {
@ -89,7 +93,7 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
//------------------------------------------------------
public init() {
super.init(frame: CGRect.zero)
super.init(frame: .zero)
setup()
}
@ -103,15 +107,9 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
setup()
}
public init(frontText: String?, actionText: String?, backText: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
super.init(frame: CGRect.zero)
setFrontText(frontText, actionText: actionText, actionMap: actionMap, backText: backText, additionalData: additionalData, delegate: delegate, buttonDelegate: buttonDelegate)
}
// MARK: - legacy
public init(frontText: String?, actionText: String?, backText: String?, actionBlock block: ActionBlock?) {
super.init(frame: CGRect.zero)
super.init(frame: .zero)
self.frontText = frontText
self.actionText = actionText
@ -121,42 +119,46 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
setup()
}
public convenience init(actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
public convenience init(actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
self.init(frontText: actionMap?.optionalStringForKey(KeyTitlePrefix),
actionText: actionMap?.optionalStringForKey(KeyTitle),
backText: actionMap?.optionalStringForKey(KeyTitlePostfix),
actionMap: actionMap, additionalData: additionalData,
delegateObject: delegateObject)
}
public convenience init(frontText: String?, backText: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
self.init(frontText: frontText,
actionText: actionMap?.optionalStringForKey(KeyTitle),
backText: backText,
actionMap: actionMap,
additionalData: additionalData,
delegateObject: delegateObject)
}
public init(frontText: String?, actionText: String?, backText: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
super.init(frame: CGRect.zero)
self.init(frontText: actionMap?.optionalStringForKey(KeyTitlePrefix), actionText: actionMap?.optionalStringForKey(KeyTitle), backText: actionMap?.optionalStringForKey(KeyTitlePostfix), actionMap: actionMap, additionalData: additionalData, actionDelegate: delegate, buttonDelegate: buttonDelegate)
}
public convenience init(frontText: String?, backText: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
self.init(frontText: frontText, actionText: actionMap?.optionalStringForKey(KeyTitle), backText: backText, actionMap: actionMap, additionalData: additionalData, actionDelegate: delegate, buttonDelegate: buttonDelegate)
}
public convenience init(frontText: String?, actionText: String?, backText: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
self.init(frontText: frontText, actionText: actionText, backText: backText, actionMap: actionMap, additionalData: additionalData, actionDelegate: delegate, buttonDelegate: nil)
}
public convenience init(actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
self.init(frontText: actionMap?.optionalStringForKey(KeyTitlePrefix), actionText: actionMap?.optionalStringForKey(KeyTitle), backText: actionMap?.optionalStringForKey(KeyTitlePostfix), actionMap: actionMap, additionalData: additionalData, actionDelegate: delegate)
}
public convenience init(frontText: String?, backText: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
self.init(frontText: frontText, actionText: actionMap?.optionalStringForKey(KeyTitle), backText: backText, actionMap: actionMap, additionalData: additionalData, actionDelegate: delegate)
setFrontText(frontText, actionText: actionText, actionMap: actionMap, backText: backText, additionalData: additionalData, delegateObject: delegateObject)
}
// Convenience Initializer which assumes that the clickable text will be embedded in curly braces {}.
public convenience init(clickableTextEmbeddedInCurlyBraces fullText: String?, actionMapForClickableText actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
self.init(text: fullText, startTag: "{", endTag: "}", actionMap: actionMap, additionalData: additionalData, actionDelegate: delegate)
public convenience init(clickableTextEmbeddedInCurlyBraces fullText: String?, actionMapForClickableText actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
self.init(text: fullText,
startTag: "{",
endTag: "}",
actionMap: actionMap,
additionalData: additionalData,
delegateObject: delegateObject)
}
public init(text fullText: String?, startTag: String?, endTag: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
public init(text fullText: String?, startTag: String?, endTag: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
super.init(frame: CGRect.zero)
setText(fullText, startTag: startTag, endTag: endTag)
weak var weakDelegate: ActionObjectDelegate? = delegate
actionBlock = {
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegate: weakDelegate as? CoreObjectActionLoadPresentDelegate)
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject)
}
}
@ -167,7 +169,7 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
private func setup() {
if self.label == nil {
let label = MFLabel(frame: CGRect.zero)
let label = Label(frame: CGRect.zero)
backgroundColor = .clear
label.isUserInteractionEnabled = false
@ -186,13 +188,11 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
self.label?.attributedText = attributedText
self.label?.accessibilityTraits = .button
}
private func
setActionMap(_ actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
@objc public func setActionMap(_ actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
weak var weakSelf: LabelWithInternalButton? = self
weak var weakDelegate: ActionObjectDelegate? = delegate
weak var weakButtonDelegate: ButtonObjectDelegate? = buttonDelegate
weak var weakButtonDelegate: ButtonDelegateProtocol? = (delegateObject as? MVMCoreUIDelegateObject)?.buttonDelegate
actionBlock = {
var performAction = true
@ -201,8 +201,8 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
performAction = wButtonDelegate.button?(wSelf, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? false
}
if let wDelegate = weakDelegate as? CoreObjectActionLoadPresentDelegate, performAction {
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegate: wDelegate)
if performAction {
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject)
}
}
}
@ -211,26 +211,22 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
// MARK: - Methods
//------------------------------------------------------
@objc public func setFrontText(_ frontText: String?, actionMap: [AnyHashable: Any]?, backText: String?, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
setFrontText(frontText, actionText: actionMap?.optionalStringForKey(KeyTitle), actionMap: actionMap, backText: backText, additionalData: additionalData, delegate: delegate, buttonDelegate: buttonDelegate)
}
@objc public func setFrontText(_ frontText: String?, actionText: String?, actionMap: [AnyHashable: Any]?, backText: String?, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
@objc public func setFrontText(_ frontText: String?, actionText: String?, actionMap: [AnyHashable: Any]?, backText: String?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
self.frontText = frontText
setActionMap(actionMap, additionalData: additionalData, actionDelegate: delegate, buttonDelegate: buttonDelegate)
setActionMap(actionMap, additionalData: additionalData, delegateObject: delegateObject)
self.actionText = actionText
self.backText = backText
text = getTextFromStringComponents()
setup()
}
@objc public func setFrontAttributedText(_ frontAttributedText: NSAttributedString?, actionMap: [AnyHashable: Any]?, backAttributedText backText: NSAttributedString?, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
@objc public func setFrontText(_ frontText: String?, actionMap: [AnyHashable: Any]?, backText: String?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
setFrontAttributedText(frontAttributedText, actionMap: actionMap, backAttributedText: backText, addNewLine: false, additionalData: additionalData, delegate: delegate, buttonDelegate: buttonDelegate)
setFrontText(frontText, actionText: actionMap?.optionalStringForKey(KeyTitle), actionMap: actionMap, backText: backText, additionalData: additionalData, delegateObject: delegateObject)
}
private func setFrontAttributedText(_ frontAttributedText: NSAttributedString?, actionMap: [AnyHashable: Any]?, backAttributedText: NSAttributedString?, addNewLine: Bool, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
@objc public func setFrontAttributedText(_ frontAttributedText: NSAttributedString?, actionMap: [AnyHashable: Any]?, backAttributedText: NSAttributedString?, addNewLine: Bool, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
let mutableAttributedString = NSMutableAttributedString()
@ -248,7 +244,7 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
let actionStringOnLine = actionString + (addNewLine ? "\n" : " ")
actionText = actionStringOnLine
setActionMap(actionMap, additionalData: additionalData, actionDelegate: delegate, buttonDelegate: buttonDelegate)
setActionMap(actionMap, additionalData: additionalData, delegateObject: delegateObject)
mutableAttributedString.append(MFStyler.styleGetAttributedString(actionStringOnLine, font: b2Font, color: .black))
} else {
@ -297,7 +293,7 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
let location: CGPoint? = touches?.first?.location(in: label)
let actionString = actionText
let index: Int = getActionRange().location
let index: Int = actionRange.location
let rangeArray = getRangeArrayOfWords(in: actionString, withInitalIndex: index)
let rectArray = getRectArray(fromRangeArray: rangeArray)
var result = false
@ -335,11 +331,6 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
return "\(frontText ?? "")\(actionText ?? "")\(backText ?? "")"
}
private func getActionRange() -> NSRange {
return NSRange(location: frontText?.count ?? 0, length: actionText?.count ?? 0)
}
private func getRangeArrayOfWords(in string: String?, withInitalIndex index: Int) -> [Any]? {
var index = index
@ -420,42 +411,27 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
actionableTuple.end = secondHalf[1]
}
}
return actionableTuple
}
@objc public func setActionMap(_ actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
setActionMap(actionMap, additionalData: additionalData, actionDelegate: delegate, buttonDelegate: nil)
}
// Reset the text and action map
@objc public func setTextWithClickableTextEmbeddedInCurlyBraces(_ text: String?, textAttributes attributes: [AnyHashable: Any]?, actionMapForClickableText actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
@objc public func setTextWithClickableTextEmbeddedInCurlyBraces(_ text: String?, textAttributes attributes: [AnyHashable: Any]?, actionMapForClickableText actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
attributedText = NSAttributedString(string: text ?? "", attributes: attributes as? [NSAttributedString.Key: Any])
setActionMap(actionMap, additionalData: additionalData, actionDelegate: delegate)
setActionMap(actionMap, additionalData: additionalData, delegateObject: delegateObject)
}
@objc public func setWithText(_ fullText: String?, startTag: String?, endTag: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
@objc public func setWithText(_ fullText: String?, startTag: String?, endTag: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
setText(fullText, startTag: startTag, endTag: endTag)
setActionMap(actionMap, additionalData: additionalData, actionDelegate: delegate)
}
@objc public func setFrontText(_ frontText: String?, actionMap: [AnyHashable: Any]?, backText: String?, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?) {
setFrontText(frontText, actionMap: actionMap, backText: backText, additionalData: additionalData, delegate: delegate, buttonDelegate: nil)
setActionMap(actionMap, additionalData: additionalData, delegateObject: delegateObject)
}
// Reset the front text, back text, action map
@objc public func setFrontAttributedText(_ frontAttributedText: NSAttributedString?, actionMap: [AnyHashable: Any]?, backAttributedText: NSAttributedString?, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?) {
@objc public func setFrontAttributedText(_ frontAttributedText: NSAttributedString?, actionMap: [AnyHashable: Any]?, backAttributedText: NSAttributedString?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
setFrontAttributedText(frontAttributedText, actionMap: actionMap, backAttributedText: backAttributedText, addNewLine: false, additionalData: additionalData, delegate: delegate)
}
@objc public func setFrontAttributedText(_ frontAttributedText: NSAttributedString?, actionMap: [AnyHashable: Any]?, backAttributedText: NSAttributedString?, addNewLine: Bool, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?) {
setFrontAttributedText(frontAttributedText, actionMap: actionMap, backAttributedText: backAttributedText, addNewLine: addNewLine, additionalData: additionalData, delegate: delegate, buttonDelegate: nil)
setFrontAttributedText(frontAttributedText, actionMap: actionMap, backAttributedText: backAttributedText, addNewLine: false, additionalData: additionalData, delegateObject: delegateObject)
}
@objc public func setAlignment(_ textAlignment: NSTextAlignment) {
@ -469,7 +445,7 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
let attributedString = NSMutableAttributedString(attributedString: thisAttributedText)
if !attributedString.string.isEmpty {
attributedString.addAttributes(theseAttributes, range: getActionRange())
attributedString.addAttributes(theseAttributes, range: actionRange)
}
attributedText = attributedString
}
@ -507,16 +483,14 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
}
/// Used to just reset the texts and actions if already initialized
@objc public func reset(withActionMap actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?) {
@objc public func reset(withActionMap actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
frontText = actionMap?.optionalStringForKey(KeyTitlePrefix)
actionText = actionMap?.optionalStringForKey(KeyTitle)
backText = actionMap?.optionalStringForKey(KeyTitlePostfix)
weak var weakDelegate: ActionObjectDelegate? = delegate
actionBlock = {
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegate: weakDelegate as? CoreObjectActionLoadPresentDelegate)
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject)
}
text = getTextFromStringComponents()
@ -551,13 +525,203 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
return UIAccessibilityCustomAction()
}
}
extension LabelWithInternalButton: MVMCoreUIMoleculeViewProtocol {
//------------------------------------------------------
// MARK: - Atomization
// MARK: - Legacy for Delegate Change
//------------------------------------------------------
@available(*, deprecated)
public init(frontText: String?, actionText: String?, backText: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
super.init(frame: CGRect.zero)
setFrontText(frontText, actionText: actionText, actionMap: actionMap, backText: backText, additionalData: additionalData, delegate: delegate, buttonDelegate: buttonDelegate)
}
@available(*, deprecated)
public convenience init(actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
self.init(frontText: actionMap?.optionalStringForKey(KeyTitlePrefix), actionText: actionMap?.optionalStringForKey(KeyTitle), backText: actionMap?.optionalStringForKey(KeyTitlePostfix), actionMap: actionMap, additionalData: additionalData, actionDelegate: delegate, buttonDelegate: buttonDelegate)
}
@available(*, deprecated)
public convenience init(frontText: String?, backText: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
self.init(frontText: frontText, actionText: actionMap?.optionalStringForKey(KeyTitle), backText: backText, actionMap: actionMap, additionalData: additionalData, actionDelegate: delegate, buttonDelegate: buttonDelegate)
}
@available(*, deprecated)
public convenience init(frontText: String?, actionText: String?, backText: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
self.init(frontText: frontText, actionText: actionText, backText: backText, actionMap: actionMap, additionalData: additionalData, actionDelegate: delegate, buttonDelegate: nil)
}
@available(*, deprecated)
public convenience init(actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
self.init(frontText: actionMap?.optionalStringForKey(KeyTitlePrefix), actionText: actionMap?.optionalStringForKey(KeyTitle), backText: actionMap?.optionalStringForKey(KeyTitlePostfix), actionMap: actionMap, additionalData: additionalData, actionDelegate: delegate)
}
@available(*, deprecated)
public convenience init(frontText: String?, backText: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
self.init(frontText: frontText, actionText: actionMap?.optionalStringForKey(KeyTitle), backText: backText, actionMap: actionMap, additionalData: additionalData, actionDelegate: delegate)
}
// Convenience Initializer which assumes that the clickable text will be embedded in curly braces {}.
@available(*, deprecated)
public convenience init(clickableTextEmbeddedInCurlyBraces fullText: String?, actionMapForClickableText actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
self.init(text: fullText, startTag: "{", endTag: "}", actionMap: actionMap, additionalData: additionalData, actionDelegate: delegate)
}
@available(*, deprecated)
public init(text fullText: String?, startTag: String?, endTag: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
super.init(frame: CGRect.zero)
setText(fullText, startTag: startTag, endTag: endTag)
weak var weakDelegate: ActionObjectDelegate? = delegate
actionBlock = {
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegate: weakDelegate as? CoreObjectActionLoadPresentDelegate)
}
}
@available(*, deprecated)
private func setActionMap(_ actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
weak var weakSelf: LabelWithInternalButton? = self
weak var weakDelegate: ActionObjectDelegate? = delegate
weak var weakButtonDelegate: ButtonObjectDelegate? = buttonDelegate
actionBlock = {
var performAction = true
if let wSelf = weakSelf, let wButtonDelegate = weakButtonDelegate, wButtonDelegate.responds(to: #selector(ButtonObjectDelegate.button(_:shouldPerformActionWithMap:additionalData:))) {
performAction = wButtonDelegate.button?(wSelf, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? false
}
if let wDelegate = weakDelegate as? CoreObjectActionLoadPresentDelegate, performAction {
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegate: wDelegate)
}
}
}
@available(*, deprecated)
@objc public func setFrontText(_ frontText: String?, actionMap: [AnyHashable: Any]?, backText: String?, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
setFrontText(frontText, actionText: actionMap?.optionalStringForKey(KeyTitle), actionMap: actionMap, backText: backText, additionalData: additionalData, delegate: delegate, buttonDelegate: buttonDelegate)
}
@available(*, deprecated)
@objc public func setFrontText(_ frontText: String?, actionText: String?, actionMap: [AnyHashable: Any]?, backText: String?, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
self.frontText = frontText
setActionMap(actionMap, additionalData: additionalData, actionDelegate: delegate, buttonDelegate: buttonDelegate)
self.actionText = actionText
self.backText = backText
text = getTextFromStringComponents()
setup()
}
@available(*, deprecated)
@objc public func setFrontAttributedText(_ frontAttributedText: NSAttributedString?, actionMap: [AnyHashable: Any]?, backAttributedText backText: NSAttributedString?, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
setFrontAttributedText(frontAttributedText, actionMap: actionMap, backAttributedText: backText, addNewLine: false, additionalData: additionalData, delegate: delegate, buttonDelegate: buttonDelegate)
}
@available(*, deprecated)
private func setFrontAttributedText(_ frontAttributedText: NSAttributedString?, actionMap: [AnyHashable: Any]?, backAttributedText: NSAttributedString?, addNewLine: Bool, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
let mutableAttributedString = NSMutableAttributedString()
if let frontAttributedText = frontAttributedText {
mutableAttributedString.append(frontAttributedText)
// Need to do this to fix the range issue
frontText = frontAttributedText.string
}
if let b2Font = MFStyler.fontB2(),
let actions = actionMap,
actions.keys.count > 0,
let actionString = actions.optionalStringForKey(KeyTitle),
!actionString.isEmpty {
let actionStringOnLine = actionString + (addNewLine ? "\n" : " ")
actionText = actionStringOnLine
setActionMap(actionMap, additionalData: additionalData, actionDelegate: delegate, buttonDelegate: buttonDelegate)
mutableAttributedString.append(MFStyler.styleGetAttributedString(actionStringOnLine, font: b2Font, color: .black))
} else {
actionText = nil
actionBlock = nil
}
if let backAttributedText = backAttributedText {
mutableAttributedString.append(backAttributedText)
}
attributedText = mutableAttributedString
// Added this line for underlining
setAlternateActionTextAttributes([NSAttributedString.Key.underlineStyle: NSNumber(value: NSUnderlineStyle.single.rawValue)])
}
@available(*, deprecated)
@objc public func setActionMap(_ actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
setActionMap(actionMap, additionalData: additionalData, actionDelegate: delegate, buttonDelegate: nil)
}
// Reset the text and action map
@available(*, deprecated)
@objc public func setTextWithClickableTextEmbeddedInCurlyBraces(_ text: String?, textAttributes attributes: [AnyHashable: Any]?, actionMapForClickableText actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
attributedText = NSAttributedString(string: text ?? "", attributes: attributes as? [NSAttributedString.Key: Any])
setActionMap(actionMap, additionalData: additionalData, actionDelegate: delegate)
}
@available(*, deprecated)
@objc public func setWithText(_ fullText: String?, startTag: String?, endTag: String?, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?) {
setText(fullText, startTag: startTag, endTag: endTag)
setActionMap(actionMap, additionalData: additionalData, actionDelegate: delegate)
}
@available(*, deprecated)
@objc public func setFrontText(_ frontText: String?, actionMap: [AnyHashable: Any]?, backText: String?, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?) {
setFrontText(frontText, actionMap: actionMap, backText: backText, additionalData: additionalData, delegate: delegate, buttonDelegate: nil)
}
// Reset the front text, back text, action map
@available(*, deprecated)
@objc public func setFrontAttributedText(_ frontAttributedText: NSAttributedString?, actionMap: [AnyHashable: Any]?, backAttributedText: NSAttributedString?, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?) {
setFrontAttributedText(frontAttributedText, actionMap: actionMap, backAttributedText: backAttributedText, addNewLine: false, additionalData: additionalData, delegate: delegate)
}
@available(*, deprecated)
@objc public func setFrontAttributedText(_ frontAttributedText: NSAttributedString?, actionMap: [AnyHashable: Any]?, backAttributedText: NSAttributedString?, addNewLine: Bool, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?) {
setFrontAttributedText(frontAttributedText, actionMap: actionMap, backAttributedText: backAttributedText, addNewLine: addNewLine, additionalData: additionalData, delegate: delegate, buttonDelegate: nil)
}
/// Used to just reset the texts and actions if already initialized
@available(*, deprecated)
@objc public func reset(withActionMap actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegate: ActionObjectDelegate?) {
frontText = actionMap?.optionalStringForKey(KeyTitlePrefix)
actionText = actionMap?.optionalStringForKey(KeyTitle)
backText = actionMap?.optionalStringForKey(KeyTitlePostfix)
weak var weakDelegate: ActionObjectDelegate? = delegate
actionBlock = {
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegate: weakDelegate as? CoreObjectActionLoadPresentDelegate)
}
text = getTextFromStringComponents()
setup()
}
}
// MARK: - Atomization
extension LabelWithInternalButton: MVMCoreUIMoleculeViewProtocol {
// Default values for view.
@objc open func setAsMolecule() {

View File

@ -1,64 +0,0 @@
//
// MFLabel.h
// mobilefirst
//
// Created by Scott Pfeil on 3/22/17.
// Copyright © 2017 Verizon Wireless. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <MVMCoreUI/MFView.h>
@class MFSizeObject;
@class DelegateObject;
@interface MFLabel : UILabel <MVMCoreViewProtocol, MVMCoreUIMoleculeViewProtocol>
- (nullable instancetype)initWithStandardFontSize:(CGFloat)size;
// Set this property if you want updateView to update the font based on this standard and the size passed in.
@property (nonatomic) CGFloat standardFontSize;
// Set this to use a custom sizing object during updateView instead of the standard.
@property (nonatomic, strong, nullable) MFSizeObject *sizeObject;
// Set the font and set to scale
- (void)setFont:(nonnull UIFont *)font scale:(BOOL)scale;
// Convenience checker for text or attributed text.
- (BOOL)hasText;
#pragma mark - 2.0
//75Bd 40pt
+ (nonnull MFLabel *)commonLabelH1:(BOOL)scale;
//75Bd 25pt
+ (nonnull MFLabel *)commonLabelH2:(BOOL)scale;
//75Bd 18pt
+ (nonnull MFLabel *)commonLabelH3:(BOOL)scale;
//75Bd 32pt
+ (nonnull MFLabel *)commonLabelH32:(BOOL)scale;
//75Bd 13pt
+ (nonnull MFLabel *)commonLabelB1:(BOOL)scale;
//55Rg 13pt
+ (nonnull MFLabel *)commonLabelB2:(BOOL)scale;
//55Rg 11pt gray
+ (nonnull MFLabel *)commonLabelB3:(BOOL)scale;
//55Rg 20pt
+ (nonnull MFLabel *)commonLabelB20:(BOOL)scale;
// Getters
+ (nonnull MFLabel *)label NS_SWIFT_NAME(commonLabel());
// Setters
+ (void)setLabel:(nullable UILabel *)label withHTML:(nullable NSString *)html;
+ (void)setUILabel:(nullable UILabel *)label withJSON:(nullable NSDictionary *)json delegateObject:(nullable DelegateObject *)delegateObject additionalData:(nullable NSDictionary *)additionalData;
- (void)styleH1:(BOOL)scale;
- (void)styleH2:(BOOL)scale;
- (void)styleH3:(BOOL)scale;
- (void)styleH32:(BOOL)scale;
- (void)styleB1:(BOOL)scale;
- (void)styleB2:(BOOL)scale;
- (void)styleB3:(BOOL)scale;
- (void)styleB20:(BOOL)scale;
@end

View File

@ -1,295 +0,0 @@
//
// MFLabel.m
// mobilefirst
//
// Created by Scott Pfeil on 3/22/17.
// Copyright © 2017 Verizon Wireless. All rights reserved.
//
#import "MFLabel.h"
#import <MVMCoreUI/MFStyler.h>
#import <MVMCoreUI/MFSizeObject.h>
#import <MVMCoreUI/MVMCoreUIConstants.h>
#import "UIColor+MFConvenience.h"
#import "MFFonts.h"
#import "MVMCoreUISplitViewController.h"
#import "MVMCoreUILoggingHandler.h"
@import MVMCore.MVMCoreGetterUtility;
@import MVMCore.NSDictionary_MFConvenience;
@import MVMCore.MVMCoreJSONConstants;
@interface MFLabel ()
@property (strong, nonatomic) NSNumber *scaleSize;
// Used for scaling the font in updateView.
@property (strong, nonatomic) NSAttributedString *originalAttributedString;
@end
@implementation MFLabel
- (void)setupView {
self.backgroundColor = [UIColor clearColor];
self.numberOfLines = 0;
self.lineBreakMode = NSLineBreakByWordWrapping;
self.translatesAutoresizingMaskIntoConstraints = NO;
}
- (instancetype)init {
if (self = [super init]) {
[self setupView];
}
return self;
}
- (instancetype)initWithCoder:(NSCoder *)coder {
self = [super initWithCoder:coder];
if (self) {
[self setupView];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self setupView];
}
return self;
}
- (instancetype)initWithStandardFontSize:(CGFloat)size {
if ([self init]) {
self.standardFontSize = size;
}
return self;
}
- (void)updateView:(CGFloat)size {
self.scaleSize = @(size);
if (self.originalAttributedString) {
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithAttributedString:self.originalAttributedString];
[attributedString removeAttribute:NSFontAttributeName range:NSMakeRange(0, attributedString.length)];
[self.originalAttributedString enumerateAttribute:NSFontAttributeName inRange:NSMakeRange(0, self.originalAttributedString.length) options:0 usingBlock:^(UIFont *value, NSRange range, BOOL * _Nonnull stop) {
// Loop the original attributed string, resize the fonts.
UIFont *font = [value fontWithSize:[[MFStyler sizeObjectGenericForCurrentDevice:value.pointSize] getValueBasedOnSize:size]];
[attributedString addAttribute:NSFontAttributeName value:font range:range];
}];
self.attributedText = attributedString;
} else if (!fequal(self.standardFontSize, 0)) {
MFSizeObject *sizeObject = self.sizeObject;
if (!sizeObject) {
sizeObject = [MFStyler sizeObjectGenericForCurrentDevice:self.standardFontSize];
}
self.font = [self.font fontWithSize:[sizeObject getValueBasedOnSize:size]];
}
}
- (void)setFont:(nonnull UIFont *)font scale:(BOOL)scale {
self.font = font;
[self setScale:scale];
}
- (void)setScale:(BOOL)scale {
if (scale) {
self.standardFontSize = self.font.pointSize;
[self updateView:(self.scaleSize ? self.scaleSize.floatValue : [MVMCoreUISplitViewController getApplicationViewWidth])];
} else {
self.standardFontSize = 0;
}
}
- (BOOL)hasText {
return self.text.length > 0 || self.attributedText.length > 0;
}
#pragma mark - 2.0
+ (nonnull MFLabel *)commonLabelH1:(BOOL)scale {
MFLabel *label = [MFLabel label];
[label styleH1:scale];
return label;
}
+ (nonnull MFLabel *)commonLabelH2:(BOOL)scale {
MFLabel *label = [MFLabel label];
[label styleH2:scale];
return label;
}
+ (nonnull MFLabel *)commonLabelH3:(BOOL)scale {
MFLabel *label = [MFLabel label];
[label styleH3:scale];
return label;
}
+ (nonnull MFLabel *)commonLabelH32:(BOOL)scale {
MFLabel *label = [MFLabel label];
[label styleH32:scale];
return label;
}
+ (nonnull MFLabel *)commonLabelB1:(BOOL)scale {
MFLabel *label = [MFLabel label];
[label styleB1:scale];
return label;
}
+ (nonnull MFLabel *)commonLabelB2:(BOOL)scale {
MFLabel *label = [MFLabel label];
[label styleB2:scale];
return label;
}
+ (nonnull MFLabel *)commonLabelB3:(BOOL)scale {
MFLabel *label = [MFLabel label];
[label styleB3:scale];
return label;
}
+ (nonnull MFLabel *)commonLabelB20:(BOOL)scale {
MFLabel *label = [MFLabel label];
[label styleB20:scale];
return label;
}
+ (nonnull MFLabel *)label {
return [[MFLabel alloc] initWithFrame:CGRectZero];
}
#pragma mark - Setters
+ (void)setLabel:(nullable UILabel *)label withHTML:(nullable NSString *)html {
NSData *data = [html dataUsingEncoding:kCFStringEncodingUTF8];
if (data) {
NSError *error = nil;
label.attributedText = [[NSAttributedString alloc] initWithData:data options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} documentAttributes:nil error:&error];
if (error) {
[[MVMCoreUILoggingHandler sharedLoggingHandler] addErrorToLog:[MVMCoreErrorObject createErrorObjectForNSError:error location:@"LabelHTMLParse"]];
}
}
}
+ (void)setUILabel:(nullable UILabel *)label withJSON:(nullable NSDictionary *)json delegateObject:(DelegateObject *)delegateObject additionalData:(nullable NSDictionary *)additionalData {
if (label) {
label.text = [json string:KeyText];
[self setLabel:label withHTML:[json string:@"html"]];
NSString *textColor = [json string:KeyTextColor];
if (textColor) {
label.textColor = [UIColor mfGetColorForHex:textColor];
}
NSString *backgroundColor = [json string:KeyBackgroundColor];
if (backgroundColor) {
label.backgroundColor = [UIColor mfGetColorForHex:backgroundColor];
}
NSString *accessibilityText = [json string:@"accessibilityText"];
if (accessibilityText) {
label.accessibilityLabel = accessibilityText;
}
NSString *fontName = [json string:@"fontName"];
NSNumber *fontSize = [json optionalNumberForKey:@"fontSize"];
if (fontName) {
label.font = [MFFonts mfFontWithName:fontName size:fontSize ? fontSize.doubleValue : label.font.pointSize];
} else if (fontSize) {
label.font = [label.font fontWithSize:fontSize.doubleValue];
}
NSArray *attributes = [json array:@"attributes"];
if (attributes) {
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:label.text attributes:@{NSFontAttributeName:label.font,NSForegroundColorAttributeName:label.textColor}];
for (NSDictionary *attribute in attributes) {
NSNumber *location = [attribute optionalNumberForKey:@"location"];
NSNumber *length = [attribute optionalNumberForKey:@"length"];
if (location && length) {
NSRange range = NSMakeRange(location.unsignedIntegerValue, length.unsignedIntegerValue);
NSString *type = [attribute string:KeyType];
if ([type isEqualToString:@"underline"]) {
[attributedString addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:range];
} else if ([type isEqualToString:@"strikethrough"]) {
[attributedString addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlineStyleThick) range:range];
} else if ([type isEqualToString:@"color"]) {
NSString *color = [attribute string:KeyTextColor];
if (color) {
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor mfGetColorForHex:color] range:range];
}
} else if ([type isEqualToString:@"font"]) {
NSString *fontName = [attribute string:@"name"];
NSNumber *fontSize = [attribute optionalNumberForKey:@"size"];
UIFont *font = nil;
if (fontName) {
font = [MFFonts mfFontWithName:fontName size:fontSize ? fontSize.doubleValue : label.font.pointSize];
} else if (fontSize) {
font = [label.font fontWithSize:fontSize.doubleValue];
}
if (font) {
[attributedString addAttribute:NSFontAttributeName value:font range:range];
}
}
}
}
label.attributedText = attributedString;
}
}
}
- (void)setWithJSON:(NSDictionary *)json delegateObject:(DelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData {
[MFLabel setUILabel:self withJSON:json delegateObject:delegateObject additionalData:additionalData];
self.originalAttributedString = self.attributedText;
}
- (BOOL)needsToBeConstrained {
return YES;
}
- (void)styleH1:(BOOL)scale {
[MFStyler styleLabelH1:self genericScaling:NO];
[self setScale:scale];
}
- (void)styleH2:(BOOL)scale {
[MFStyler styleLabelH2:self genericScaling:NO];
[self setScale:scale];
}
- (void)styleH3:(BOOL)scale {
[MFStyler styleLabelH3:self genericScaling:NO];
[self setScale:scale];
}
- (void)styleH32:(BOOL)scale {
[MFStyler styleLabelH32:self genericScaling:NO];
[self setScale:scale];
}
- (void)styleB1:(BOOL)scale {
[MFStyler styleLabelB1:self genericScaling:NO];
[self setScale:scale];
}
- (void)styleB2:(BOOL)scale {
[MFStyler styleLabelB2:self genericScaling:NO];
[self setScale:scale];
}
- (void)styleB3:(BOOL)scale {
[MFStyler styleLabelB3:self genericScaling:NO];
[self setScale:scale];
}
- (void)styleB20:(BOOL)scale {
[MFStyler styleLabelB20:self genericScaling:NO];
[self setScale:scale];
}
- (void)setAccessibilityTraits:(UIAccessibilityTraits)accessibilityTraits {
if (accessibilityTraits& UIAccessibilityTraitHeader) {
UIAccessibilityTraits noHeaderTraits = accessibilityTraits - UIAccessibilityTraitHeader;
[super setAccessibilityTraits:noHeaderTraits];
} else {
[super setAccessibilityTraits:accessibilityTraits];
}
}
@end

View File

@ -9,7 +9,7 @@
#import <UIKit/UIKit.h>
#import <MVMCoreUI/MFView.h>
#import <MVMCoreUI/MVMCoreUICheckMarkView.h>
#import <MVMCoreUI/MFLabel.h>
@class Label;
@class MFSizeObject;
@interface MVMCoreUICheckBox : UIControl <MVMCoreViewProtocol>
@ -23,7 +23,7 @@
@property (nullable, strong, nonatomic) UIColor *unCheckedColor;
// Label to the right of the check box.
@property (nullable, weak, nonatomic) MFLabel *descriptionLabel;
@property (nullable, weak, nonatomic) Label *descriptionLabel;
// Setter for the descriptionLabel.text. Also sets the accessibility text.
@property (nullable, strong, nonatomic) NSString *descriptionText;

View File

@ -16,6 +16,7 @@
#import "UIColor+MFConvenience.h"
#import "MVMCoreUIUtility.h"
#import "MFStyler.h"
#import <MVMCoreUI/MVMCoreUI-Swift.h>
static const CGFloat FaultTolerance = 20.f;
static const CGFloat CheckBoxHeightWidth = 18.0;
@ -186,7 +187,7 @@ static const CGFloat CheckBoxHeightWidth = 18.0;
//label
if (!self.descriptionLabel) {
MFLabel *descriptionLabel = [MFLabel commonLabelB2:YES];
Label *descriptionLabel = [Label commonLabelB2:YES];
[containterView addSubview:descriptionLabel];
[NSLayoutConstraint constraintPinSubview:descriptionLabel pinCenterX:NO pinCenterY:YES];
[NSLayoutConstraint constraintPinSubview:descriptionLabel pinTop:NO pinBottom:NO pinLeft:NO pinRight:YES];

View File

@ -10,7 +10,6 @@
#import <MVMCoreUI/StackableViewController.h>
#import <MVMCoreUI/ViewConstrainingView.h>
#import <MVMCoreUI/TopLabelsView.h>
@class LabelView;
@class PrimaryButton;

View File

@ -72,8 +72,6 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[];
#pragma mark - Atoms
#pragma mark Views
#import <MVMCoreUI/MFView.h>
#import <MVMCoreUI/MFLabel.h>
#import <MVMCoreUI/ViewConstrainingView.h>
#import <MVMCoreUI/MFLoadingSpinner.h>
#import <MVMCoreUI/MFTextView.h>

View File

@ -9,8 +9,8 @@
import UIKit
public class StandardHeaderView: ViewConstrainingView {
let headlineLabel = MFLabel.commonLabelH2(true)
let messageLabel = MFLabel.commonLabelB2(true)
let headlineLabel = Label.commonLabelH2(true)
let messageLabel = Label.commonLabelB2(true)
var separatorView: SeparatorView?
var spaceBetweenLabels: NSLayoutConstraint?
var leftConstraintTitle: NSLayoutConstraint?
@ -75,10 +75,10 @@ public class StandardHeaderView: ViewConstrainingView {
}
public func setSpacing() {
if headlineLabel.hasText() && messageLabel.hasText() {
if headlineLabel.hasText && messageLabel.hasText {
spaceBetweenLabels?.constant = PaddingTwo
show()
} else if headlineLabel.hasText() || messageLabel.hasText() {
} else if headlineLabel.hasText || messageLabel.hasText {
spaceBetweenLabels?.constant = 0
show()
} else {

View File

@ -7,17 +7,16 @@
//
#import <UIKit/UIKit.h>
#import <MVMCoreUI/MFView.h>
#import <MVMCoreUI/MFLabel.h>
@class Label;
#import <MVMCoreUI/SeparatorView.h>
@class TopLabelsAndBottomButtonsTableViewController;
@interface TopLabelsView : MFView
@property (nullable, weak, nonatomic) MFLabel *headlineLabel;
@property (nullable, weak, nonatomic) MFLabel *messageLabel;
@property (nullable, weak, nonatomic) Label *headlineLabel;
@property (nullable, weak, nonatomic) Label *messageLabel;
@property (nullable, strong, nonatomic) NSLayoutConstraint *topLabelConstraint;
@property (nullable, weak, nonatomic) NSLayoutConstraint *spaceBetweenLabels;

View File

@ -14,6 +14,7 @@
#import <MVMCoreUI/MFStyler.h>
#import <MVMCore/MVMCoreConstants.h>
#import <MVMCoreUI/NSLayoutConstraint+MFConvenience.h>
#import <MVMCoreUI/MVMCoreUI-Swift.h>
@interface TopLabelsView ()
@ -54,12 +55,12 @@
self.clipsToBounds = YES;
[self.headlineLabel removeFromSuperview];
MFLabel *headlineLabel = [MFLabel commonLabelH2:YES];
Label *headlineLabel = [Label commonLabelH2:YES];
[self addSubview:headlineLabel];
self.headlineLabel = headlineLabel;
[self.messageLabel removeFromSuperview];
MFLabel *messageLabel = [MFLabel commonLabelB2:YES];
Label *messageLabel = [Label commonLabelB2:YES];
[self addSubview:messageLabel];
self.messageLabel = messageLabel;

View File

@ -22,7 +22,7 @@
static NSMutableDictionary <NSString *, Class>*mapping;
dispatch_once(&onceToken, ^{
mapping = [@{
@"label": MFLabel.class,
@"label": Label.class,
@"separator": SeparatorView.class,
@"button": ButtonView.class,
@"textButton": MFTextButton.class,