the latest
This commit is contained in:
parent
b4a5ec2ded
commit
0a6b316198
@ -81,7 +81,7 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
|
||||
return NSRange(location: 0, length: frontText?.count ?? 0)
|
||||
}
|
||||
|
||||
private var actionRange: NSRange {
|
||||
public var actionRange: NSRange {
|
||||
return NSRange(location: frontText?.count ?? 0, length: actionText?.count ?? 0)
|
||||
}
|
||||
|
||||
|
||||
@ -8,14 +8,22 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
@objcMembers public class LeftRightLabelModel: MoleculeModelProtocol {
|
||||
@objcMembers open class LeftRightLabelModel: MoleculeModelProtocol {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//--------------------------------------------------
|
||||
|
||||
public static var identifier: String = "leftRightLabelView"
|
||||
public var moleculeName: String? = LeftRightLabelModel.identifier
|
||||
public var backgroundColor: Color?
|
||||
public var leftText: LabelModel
|
||||
public var rightText: LabelModel?
|
||||
|
||||
init(_ leftText: LabelModel) {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializer
|
||||
//--------------------------------------------------
|
||||
|
||||
public init(_ leftText: LabelModel) {
|
||||
self.leftText = leftText
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ import UIKit
|
||||
}
|
||||
|
||||
// MARK: - MFViewProtocol
|
||||
public func updateView(_ size: CGFloat) {
|
||||
open func updateView(_ size: CGFloat) {
|
||||
containerHelper.updateViewMargins(self, model: listItemModel, size: size)
|
||||
|
||||
if accessoryView != nil {
|
||||
@ -151,7 +151,7 @@ import UIKit
|
||||
}
|
||||
|
||||
//TODO: ModelProtocol, Change to model
|
||||
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
guard let model = model as? ListItemModelProtocol else { return }
|
||||
|
||||
self.listItemModel = model
|
||||
@ -183,11 +183,11 @@ import UIKit
|
||||
backgroundColor = .white
|
||||
}
|
||||
|
||||
public class func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||
open class func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||
return model.moleculeName
|
||||
}
|
||||
|
||||
public class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
open class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@ -23,15 +23,15 @@ open class Container: View, ContainerProtocol {
|
||||
}
|
||||
|
||||
// MARK:- ContainerProtocol
|
||||
public func alignHorizontal(_ alignment: UIStackView.Alignment) {
|
||||
open func alignHorizontal(_ alignment: UIStackView.Alignment) {
|
||||
containerHelper.alignHorizontal(alignment)
|
||||
}
|
||||
|
||||
public func alignVertical(_ alignment: UIStackView.Alignment) {
|
||||
open func alignVertical(_ alignment: UIStackView.Alignment) {
|
||||
containerHelper.alignVertical(alignment)
|
||||
}
|
||||
|
||||
public func constrainView(_ view: UIView) {
|
||||
open func constrainView(_ view: UIView) {
|
||||
containerHelper.constrainView(view)
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public class ContainerHelper: NSObject {
|
||||
open class ContainerHelper: NSObject {
|
||||
var leftConstraint: NSLayoutConstraint?
|
||||
var topConstraint: NSLayoutConstraint?
|
||||
var bottomConstraint: NSLayoutConstraint?
|
||||
@ -28,7 +28,7 @@ public class ContainerHelper: NSObject {
|
||||
var bottomLowConstraint: NSLayoutConstraint?
|
||||
var rightLowConstraint: NSLayoutConstraint?
|
||||
|
||||
func constrainView(_ view: UIView) {
|
||||
open func constrainView(_ view: UIView) {
|
||||
guard let margins = view.superview?.layoutMarginsGuide else { return }
|
||||
leftConstraint = view.leftAnchor.constraint(equalTo: margins.leftAnchor)
|
||||
leftConstraint?.isActive = true
|
||||
@ -69,7 +69,7 @@ public class ContainerHelper: NSObject {
|
||||
setAccessibility(view)
|
||||
}
|
||||
|
||||
func setAccessibility(_ view: UIView) {
|
||||
open func setAccessibility(_ view: UIView) {
|
||||
guard let superView = view.superview else { return }
|
||||
superView.isAccessibilityElement = false
|
||||
if let elements = view.accessibilityElements {
|
||||
@ -79,7 +79,7 @@ public class ContainerHelper: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
func alignHorizontal(_ alignment: UIStackView.Alignment) {
|
||||
open func alignHorizontal(_ alignment: UIStackView.Alignment) {
|
||||
switch alignment {
|
||||
case .center:
|
||||
alignCenterHorizontalConstraint?.isActive = true
|
||||
@ -109,7 +109,7 @@ public class ContainerHelper: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
func alignVertical(_ alignment: UIStackView.Alignment) {
|
||||
open func alignVertical(_ alignment: UIStackView.Alignment) {
|
||||
switch alignment {
|
||||
case .center:
|
||||
alignCenterVerticalConstraint?.isActive = true
|
||||
@ -139,7 +139,7 @@ public class ContainerHelper: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
static func getAlignment(for string: String) -> UIStackView.Alignment? {
|
||||
public static func getAlignment(for string: String) -> UIStackView.Alignment? {
|
||||
switch string {
|
||||
case "leading":
|
||||
return .leading
|
||||
@ -154,7 +154,7 @@ public class ContainerHelper: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
static func getAlignmentString(for alignment: UIStackView.Alignment?) -> String? {
|
||||
public static func getAlignmentString(for alignment: UIStackView.Alignment?) -> String? {
|
||||
switch alignment {
|
||||
case .leading:
|
||||
return "leading"
|
||||
@ -169,11 +169,11 @@ public class ContainerHelper: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
func updateViewMargins(_ view: UIView, model: ContainerModelProtocol?, size: CGFloat) {
|
||||
open func updateViewMargins(_ view: UIView, model: ContainerModelProtocol?, size: CGFloat) {
|
||||
MFStyler.setMarginsFor(view, size: size, defaultHorizontal: model?.useHorizontalMargins ?? false, top: (model?.useVerticalMargins ?? false) ? (model?.topMarginPadding ?? 0) : 0, bottom: (model?.useVerticalMargins ?? false) ? (model?.bottomMarginPadding ?? 0) : 0)
|
||||
}
|
||||
|
||||
func set(with model: ContainerModelProtocol, for contained: MVMCoreUIViewConstrainingProtocol?) {
|
||||
open func set(with model: ContainerModelProtocol, for contained: MVMCoreUIViewConstrainingProtocol?) {
|
||||
if let horizontalAlignment = model.horizontalAlignment ?? contained?.horizontalAlignment?() {
|
||||
alignHorizontal(horizontalAlignment)
|
||||
}
|
||||
@ -182,7 +182,7 @@ public class ContainerHelper: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
func set(with JSON: [AnyHashable: Any]?, for contained: UIView) {
|
||||
open func set(with JSON: [AnyHashable: Any]?, for contained: UIView) {
|
||||
if let horizontalAlignmentString = JSON?.optionalStringForKey("horizontalAlignment"), let alignment = ContainerHelper.getAlignment(for: horizontalAlignmentString) ?? (contained as? MVMCoreUIViewConstrainingProtocol)?.horizontalAlignment?() {
|
||||
alignHorizontal(alignment)
|
||||
} else if let alignment = (contained as? MVMCoreUIViewConstrainingProtocol)?.horizontalAlignment?() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user