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 {
return "\(LabelAttributeModel.self)"
"\(LabelAttributeModel.self)"
}
public static var categoryCodingKey: String {
return "type"
}
public static var categoryCodingKey: String { "type" }
public class var identifier: String {
return ""
}
public class var identifier: String { "" }
var type: String {
get { return Self.identifier }
get { Self.identifier }
}
var location: Int

View File

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

View File

@ -58,6 +58,10 @@ import UIKit
if let backgroundColor = model.backgroundColor {
self.backgroundColor = backgroundColor.uiColor
}
if let identifier = model.accessibilityIdentifier {
accessibilityIdentifier = identifier
}
}
open func reset() {
@ -67,16 +71,12 @@ import UIKit
// 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.
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? {
return nil
}
open class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { nil }
open class func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
return nil
}
open class func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? { nil }
}
// MARK:- MVMCoreViewProtocol

View File

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

View File

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