Merge branch 'feature/model_wip_kamlesh' of gitlab.verizon.com:BPHV_MIPS/mvm_core_ui into feature/model_wip_kamlesh

This commit is contained in:
Suresh, Kamlesh 2020-01-09 16:00:09 -05:00
commit 49a7df70e1
6 changed files with 7 additions and 47 deletions

View File

@ -342,8 +342,8 @@
self.updateViewVerticalDefaults = NO;
self.topMarginPadding = PaddingDefaultVerticalSpacing3;
self.bottomMarginPadding = PaddingDefaultVerticalSpacing3;
if ([self.molecule respondsToSelector:@selector(alignment)]) {
[self alignHorizontal:[(UIView <MVMCoreUIViewConstrainingProtocol> *)self.molecule alignment]];
if ([self.molecule respondsToSelector:@selector(horizontalAlignment)]) {
[self alignHorizontal:[(UIView <MVMCoreUIViewConstrainingProtocol> *)self.molecule horizontalAlignment]];
}
[self alignVertical:UIStackViewAlignmentFill];
if ([self.molecule respondsToSelector:@selector(reset)]) {

View File

@ -51,6 +51,9 @@ import UIKit
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
self.model = model
if let backgroundColor = model?.backgroundColor {
self.backgroundColor = backgroundColor.uiColor
}
}
//--------------------------------------------------

View File

@ -1,40 +0,0 @@
//
// ContainerMoleculeProtocol.swift
// MVMCoreUI
//
// Created by Suresh, Kamlesh on 12/4/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import Foundation
public protocol ContainerMoleculeProtocol: MoleculeProtocol {
var molecule: MoleculeProtocol { get }
var useHorizontalMargins: Bool? { get }
var useVerticalMargins: Bool? { get }
var horizontalAlignment: String? { get }
var verticalAlignment: String? { get }
}
extension ContainerMoleculeProtocol {
public var backgroundColor: Color? {
get { return nil }
}
public var useHorizontalMargins: Bool? {
get { return nil }
}
public var useVerticalMargins: Bool? {
get { return nil }
}
public var horizontalAlignment: String? {
get { return nil }
}
public var verticalAlignment: String? {
get { return nil }
}
}

View File

@ -37,7 +37,7 @@ public extension MVMCoreUIMoleculeMappingObject {
if constrainIfNeeded, let castMolecule = molecule as? MVMCoreUIViewConstrainingProtocol,
castMolecule.needsToBeConstrained?() ?? false {
let view = ViewConstrainingView(molecule: molecule, alignment: castMolecule.alignment?() ?? .fill)
let view = ViewConstrainingView(molecule: molecule, alignment: castMolecule.horizontalAlignment?() ?? .fill)
setData()
return view
} else {

View File

@ -121,7 +121,7 @@
// Check if we need to constrain this view.
UIView <MVMCoreUIViewConstrainingProtocol> *castMolecule = [molecule conformsToProtocol:@protocol(MVMCoreUIViewConstrainingProtocol)] ? (UIView <MVMCoreUIViewConstrainingProtocol> *)molecule : nil;
if (constrainIfNeeded && [castMolecule respondsToSelector:@selector(needsToBeConstrained)] && [castMolecule needsToBeConstrained]) {
molecule = [[ViewConstrainingView alloc] initWithMolecule:molecule alignment:[castMolecule respondsToSelector:@selector(alignment)] ? [castMolecule alignment] : UIStackViewAlignmentFill];
molecule = [[ViewConstrainingView alloc] initWithMolecule:molecule alignment:[castMolecule respondsToSelector:@selector(horizontalAlignment)] ? [castMolecule horizontalAlignment] : UIStackViewAlignmentFill];
}
[molecule setWithJSON:json delegateObject:delegateObject additionalData:nil];
return molecule;

View File

@ -15,9 +15,6 @@
/// Notifies the creator that the view may not be suitable to be shown on its own and it needs to be added to a view to help with layout.
- (BOOL)needsToBeConstrained;
/// The alignment if constrained.
- (UIStackViewAlignment)alignment __deprecated;
/// The alignment if constrained.
- (UIStackViewAlignment)horizontalAlignment;