updates made.

This commit is contained in:
Kevin G Christiano 2020-12-02 11:40:36 -05:00
parent 1cb2899bb0
commit 83d0786597
5 changed files with 27 additions and 30 deletions

View File

@ -13,19 +13,15 @@
//-------------------------------------------------- //--------------------------------------------------
public static var categoryName: String { public static var categoryName: String {
return "\(LabelAttributeModel.self)" "\(LabelAttributeModel.self)"
} }
public static var categoryCodingKey: String { public static var categoryCodingKey: String { "type" }
return "type"
}
public class var identifier: String { public class var identifier: String { "" }
return ""
}
var type: String { var type: String {
get { return Self.identifier } get { Self.identifier }
} }
var location: Int var location: Int

View File

@ -10,19 +10,25 @@ public enum MolecularError: Swift.Error {
public protocol MoleculeModelProtocol: ModelProtocol { public protocol MoleculeModelProtocol: ModelProtocol {
var moleculeName: String { get } var moleculeName: String { get }
var backgroundColor: Color? { get set } var backgroundColor: Color? { get set }
var accessibilityIdentifier: String? { get set }
} }
public extension MoleculeModelProtocol { public extension MoleculeModelProtocol {
var moleculeName: String { var moleculeName: String {
get { return Self.identifier } get { Self.identifier }
}
var accessibilityIdentifier: String? {
get { nil }
set { }
} }
static var categoryName: String { static var categoryName: String {
return "\(MoleculeModelProtocol.self)" "\(MoleculeModelProtocol.self)"
} }
static var categoryCodingKey: String { static var categoryCodingKey: String {
return "moleculeName" "moleculeName"
} }
} }

View File

@ -58,6 +58,10 @@ import UIKit
if let backgroundColor = model.backgroundColor { if let backgroundColor = model.backgroundColor {
self.backgroundColor = backgroundColor.uiColor self.backgroundColor = backgroundColor.uiColor
} }
if let identifier = model.accessibilityIdentifier {
accessibilityIdentifier = identifier
}
} }
open func reset() { open func reset() {
@ -67,16 +71,12 @@ import UIKit
// MARK: Overridables // MARK: Overridables
// Base classes need to implement these functions otherwise swift won't respect the subclass functions and use the ones in the protocol extension instead. // Base classes need to implement these functions otherwise swift won't respect the subclass functions and use the ones in the protocol extension instead.
open class func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? { open class func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
return model.moleculeName model.moleculeName
} }
open class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { open class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { nil }
return nil
}
open class func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? { open class func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? { nil }
return nil
}
} }
// MARK:- MVMCoreViewProtocol // MARK:- MVMCoreViewProtocol

View File

@ -10,23 +10,22 @@ import Foundation
public protocol PageBehaviorProtocol: ModelProtocol { public protocol PageBehaviorProtocol: ModelProtocol {
// The type of rule /// The type of rule
var behaviorName: String { get } var behaviorName: String { get }
} }
public extension PageBehaviorProtocol { public extension PageBehaviorProtocol {
var behaviorName: String { var behaviorName: String {
get { return Self.identifier } get { Self.identifier }
} }
static var categoryCodingKey: String { static var categoryCodingKey: String {
return "behaviorName" "behaviorName"
} }
static var categoryName: String { static var categoryName: String {
return "\(PageBehaviorProtocol.self)" "\(PageBehaviorProtocol.self)"
} }
} }
@ -34,11 +33,9 @@ public protocol PageVisibilityBehavior: PageBehaviorProtocol {
func onPageShown() func onPageShown()
func onPageHidden() func onPageHidden()
} }
public protocol PageBehaviorsTemplateProtocol { public protocol PageBehaviorsTemplateProtocol {
var behaviors: [PageBehaviorProtocol]? { get } var behaviors: [PageBehaviorProtocol]? { get }
} }

View File

@ -32,15 +32,13 @@ public protocol RulesProtocol: ModelProtocol {
public extension RulesProtocol { public extension RulesProtocol {
var type: String { var type: String {
get { return Self.identifier } get { Self.identifier }
} }
static var categoryCodingKey: String { static var categoryCodingKey: String { "type" }
return "type"
}
static var categoryName: String { static var categoryName: String {
return "\(RulesProtocol.self)" "\(RulesProtocol.self)"
} }
// Individual rule can override the function to validate based on the rule type. // Individual rule can override the function to validate based on the rule type.