formatting. json. updates.

This commit is contained in:
Kevin G Christiano 2020-12-18 14:47:11 -05:00
parent 6b3dd399cf
commit af83f4f8b5
12 changed files with 23 additions and 41 deletions

View File

@ -1707,6 +1707,8 @@
D2092348244A51D40044AD09 /* RadioSwatchModel.swift */,
AAB9C109243496DD00151545 /* RadioSwatch.swift */,
AA85236B244435A20059CC1E /* RadioSwatchCollectionViewCell.swift */,
D260105223CEA61600764D80 /* ToggleModel.swift */,
0AA33B392398524F0067DD0F /* Toggle.swift */,
AAA7CD68250641F90045B959 /* HeartModel.swift */,
AAA7CD6A250642080045B959 /* Heart.swift */,
);
@ -2004,8 +2006,6 @@
D28A838223CCBD3F00DFE4FC /* WheelModel.swift */,
943784F3236B77BB006A1E82 /* Wheel.swift */,
943784F4236B77BB006A1E82 /* WheelAnimationHandler.swift */,
D260105223CEA61600764D80 /* ToggleModel.swift */,
0AA33B392398524F0067DD0F /* Toggle.swift */,
0AE98BB623FF18E9004C5109 /* ArrowModel.swift */,
0AE98BB423FF18D2004C5109 /* Arrow.swift */,
94382085243238D100B43AF3 /* WebViewModel.swift */,

View File

@ -142,6 +142,7 @@ open class CaretLink: Button, MVMCoreUIViewConstrainingProtocol {
backgroundColor = color.uiColor
}
accessibilityIdentifier = model.accessibilityIdentifier
enabledColor = (model.inverted ? model.enabledColor_inverted : model.enabledColor).uiColor
disabledColor = (model.inverted ? model.disabledColor_inverted : model.disabledColor).uiColor

View File

@ -241,6 +241,7 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
textView.isEditable = model.editable
textView.textAlignment = model.textAlignment
textView.accessibilityIdentifier = model.accessibilityIdentifier
textView.textColor = model.enabled ? model.enabledTextColor.uiColor : model.disabledTextColor.uiColor
textView.font = model.fontStyle.getFont()
textView.placeholder = model.placeholder ?? ""
@ -258,7 +259,7 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
case .email:
textView.keyboardType = .emailAddress
default: break
default: break
}
/// No point in configuring if the TextView is Read-only.

View File

@ -40,7 +40,7 @@ public typealias ActionBlockConfirmation = () -> (Bool)
/// Executes logic before state change. If false, then toggle state will not change and the didToggleAction will not execute.
public var shouldToggleAction: ActionBlockConfirmation? = {
return { return true }
return { true }
}()
// Sizes are from InVision design specs.
@ -69,9 +69,7 @@ public typealias ActionBlockConfirmation = () -> (Bool)
/// Simple means to prevent user interaction with the toggle.
public var isLocked: Bool = false {
didSet {
isUserInteractionEnabled = !isLocked
}
didSet { isUserInteractionEnabled = !isLocked }
}
/// The state on the toggle. Default value: false.
@ -109,7 +107,7 @@ public typealias ActionBlockConfirmation = () -> (Bool)
}
public var toggleModel: ToggleModel? {
return model as? ToggleModel
model as? ToggleModel
}
//--------------------------------------------------
@ -414,18 +412,14 @@ public typealias ActionBlockConfirmation = () -> (Bool)
}
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
return Self.getContainerHeight()
Self.getContainerHeight()
}
}
// MARK: - MVMCoreUIViewConstrainingProtocol
extension Toggle {
public func needsToBeConstrained() -> Bool {
return true
}
public func needsToBeConstrained() -> Bool { true }
public func horizontalAlignment() -> UIStackView.Alignment {
return .trailing
}
public func horizontalAlignment() -> UIStackView.Alignment { .trailing }
}

View File

@ -6,8 +6,6 @@
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import UIKit
public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol, EnableableModelProtocol {
//--------------------------------------------------
@ -15,6 +13,7 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol, EnableableMo
//--------------------------------------------------
public static var identifier: String = "toggle"
public var accessibilityIdentifier: String?
public var backgroundColor: Color?
public var state: Bool = false
public var animated: Bool = true
@ -42,6 +41,7 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol, EnableableMo
case enabled
case action
case backgroundColor
case accessibilityIdentifier
case alternateAction
case accessibilityText
case onTintColor
@ -56,9 +56,7 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol, EnableableMo
// MARK: - Methods
//--------------------------------------------------
public func formFieldValue() -> AnyHashable? {
return state
}
public func formFieldValue() -> AnyHashable? { state }
//--------------------------------------------------
// MARK: - Initializer
@ -91,6 +89,7 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol, EnableableMo
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
alternateAction = try typeContainer.decodeModelIfPresent(codingKey: .alternateAction)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
if let onTintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .onTintColor) {
self.onTintColor = onTintColor
@ -120,6 +119,7 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol, EnableableMo
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encodeModelIfPresent(action, forKey: .action)
try container.encodeModelIfPresent(alternateAction, forKey: .alternateAction)
try container.encode(moleculeName, forKey: .moleculeName)

View File

@ -12,9 +12,7 @@ open class LabelAttributeActionModel: LabelAttributeModel {
// MARK: - Properties
//--------------------------------------------------
override public class var identifier: String {
return "action"
}
override public class var identifier: String { "action" }
var action: ActionModelProtocol

View File

@ -12,9 +12,7 @@
// MARK: - Properties
//--------------------------------------------------
override public class var identifier: String {
return "color"
}
override public class var identifier: String { "color" }
var textColor: Color?

View File

@ -12,9 +12,7 @@
// MARK: - Properties
//--------------------------------------------------
override public class var identifier: String {
return "font"
}
override public class var identifier: String { "font" }
var style: Styler.Font?
var name: String?

View File

@ -12,9 +12,7 @@ class LabelAttributeImageModel: LabelAttributeModel {
// MARK: - Properties
//--------------------------------------------------
override public class var identifier: String {
return "image"
}
override public class var identifier: String { "image" }
var size: CGFloat?
var name: String?

View File

@ -12,9 +12,7 @@
// MARK: - Properties
//--------------------------------------------------
public static var categoryName: String {
"\(LabelAttributeModel.self)"
}
public static var categoryName: String { "\(LabelAttributeModel.self)" }
public static var categoryCodingKey: String { "type" }

View File

@ -12,9 +12,7 @@
// MARK: - Properties
//--------------------------------------------------
override public class var identifier: String {
return "strikethrough"
}
override public class var identifier: String { "strikethrough" }
//--------------------------------------------------
// MARK: - Initializer

View File

@ -14,9 +14,7 @@ import UIKit
// MARK: - Properties
//--------------------------------------------------
override public class var identifier: String {
return "underline"
}
override public class var identifier: String { "underline" }
/// This returns the NSUnderlineStyle used in NSAttributedValue. If there is a pattern, it will return
/// a new NSUnderlineStyle derived from the bitmask of style | pattern.