This commit is contained in:
Pfeil, Scott Robert 2020-03-17 12:15:26 -04:00
commit 29d9ea317d
4 changed files with 9 additions and 12 deletions

View File

@ -181,7 +181,7 @@ import UIKit
let widthWillChange = !MVMCoreGetterUtility.cgfequal(widthConstraint?.constant ?? 0, width ?? 0) let widthWillChange = !MVMCoreGetterUtility.cgfequal(widthConstraint?.constant ?? 0, width ?? 0)
let heightWillChange = !MVMCoreGetterUtility.cgfequal(heightConstraint?.constant ?? 0, height ?? 0) let heightWillChange = !MVMCoreGetterUtility.cgfequal(heightConstraint?.constant ?? 0, height ?? 0)
let sizeWillChange = (width == nil || height == nil) && !(size?.equalTo(imageView.image?.size ?? CGSize.zero) ?? false) let sizeWillChange = (width == nil || height == nil) && !(size?.equalTo(imageView.image?.size ?? CGSize.zero) ?? false)
let heightChangeFromSpinner = ((height ?? size?.height) ?? 0) < loadingSpinnerHeightConstraint?.constant ?? CGFloat.leastNormalMagnitude let heightChangeFromSpinner = (heightConstraint?.isActive ?? false) ? false : ((height ?? size?.height) ?? 0) < loadingSpinnerHeightConstraint?.constant ?? CGFloat.leastNormalMagnitude
return widthWillChange || heightWillChange || sizeWillChange || heightChangeFromSpinner return widthWillChange || heightWillChange || sizeWillChange || heightChangeFromSpinner
} }

View File

@ -8,7 +8,7 @@
import Foundation import Foundation
@objcMembers open class HeadersH2NoButtonsBodyText: View { @objcMembers open class HeadersH2NoButtonsBodyText: HeaderView {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
//-------------------------------------------------- //--------------------------------------------------
@ -20,8 +20,7 @@ import Foundation
open override func setupView() { open override func setupView() {
super.setupView() super.setupView()
headlineBody.stylePageHeader() headlineBody.stylePageHeader()
addSubview(headlineBody) addMolecule(headlineBody)
NSLayoutConstraint.constraintPinSubview(toSuperview: headlineBody)
} }
//---------------------------------------------------- //----------------------------------------------------

View File

@ -8,13 +8,11 @@
import Foundation import Foundation
public class HeadersH2NoButtonsBodyTextModel: MoleculeModelProtocol { public class HeadersH2NoButtonsBodyTextModel: HeaderModel, MoleculeModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
public static var identifier: String = "headerH2" public static var identifier: String = "headerH2"
public var backgroundColor: Color?
public var headlineBody: HeadlineBodyModel public var headlineBody: HeadlineBodyModel
//-------------------------------------------------- //--------------------------------------------------
@ -22,6 +20,7 @@ public class HeadersH2NoButtonsBodyTextModel: MoleculeModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
public init(headlineBody: HeadlineBodyModel) { public init(headlineBody: HeadlineBodyModel) {
self.headlineBody = headlineBody self.headlineBody = headlineBody
super.init()
} }
//-------------------------------------------------- //--------------------------------------------------
@ -29,7 +28,6 @@ public class HeadersH2NoButtonsBodyTextModel: MoleculeModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName case moleculeName
case backgroundColor
case headlineBody case headlineBody
} }
@ -38,14 +36,14 @@ public class HeadersH2NoButtonsBodyTextModel: MoleculeModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody) headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody)
try super.init(from: decoder)
} }
public func encode(to encoder: Encoder) throws { public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encode(headlineBody, forKey: .headlineBody) try container.encode(headlineBody, forKey: .headlineBody)
} }
} }