typo fixes
This commit is contained in:
parent
4a1a196854
commit
347ebbed8c
@ -50,7 +50,7 @@
|
||||
+ (nonnull ViewConstrainingView *)viewConstrainingView:(nonnull UIView *)view;
|
||||
|
||||
// Can be initialized with a molecule to constrain
|
||||
- (nullable instancetype)initWithMolecule:(nonnull UIView <MVMCoreUIMoleculeViewProtocol>*)molecule alignment:(UIStackViewAlignment)alignment;
|
||||
- (nonnull instancetype)initWithMolecule:(nonnull UIView <MVMCoreUIMoleculeViewProtocol>*)molecule alignment:(UIStackViewAlignment)alignment;
|
||||
|
||||
#pragma mark - Constraining
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
@implementation ViewConstrainingView
|
||||
|
||||
- (nullable instancetype)initWithMolecule:(nonnull UIView <MVMCoreUIMoleculeViewProtocol>*)molecule alignment:(UIStackViewAlignment)alignment {
|
||||
- (nonnull instancetype)initWithMolecule:(nonnull UIView <MVMCoreUIMoleculeViewProtocol>*)molecule alignment:(UIStackViewAlignment)alignment {
|
||||
if (self = [super init]) {
|
||||
if (!molecule.superview) {
|
||||
[self addConstrainedView:molecule alignment:alignment];
|
||||
|
||||
@ -13,12 +13,12 @@ extension Encodable {
|
||||
}
|
||||
|
||||
public func toJSON() -> JSONObject? {
|
||||
guard let data = try? self.encode() else { return nil }
|
||||
guard let data = try? encode() else { return nil }
|
||||
return (try? JSONSerialization.jsonObject(with: data, options: .allowFragments)).flatMap { $0 as? JSONObject }
|
||||
}
|
||||
|
||||
public func toJSONString() -> String? {
|
||||
guard let data = try? self.encode(),
|
||||
guard let data = try? encode(),
|
||||
let string = String(data: data, encoding: .utf8) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -69,8 +69,8 @@ extension Holder {
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
guard let encode = HolderManager.encoders[self.name],
|
||||
let holdable = self.object as? Holdable else{
|
||||
guard let encode = HolderManager.encoders[name],
|
||||
let holdable = object as? Holdable else {
|
||||
throw HolderManager.Error.encoderError
|
||||
}
|
||||
try encode(holdable, &container)
|
||||
|
||||
@ -3,7 +3,7 @@ import Foundation
|
||||
public typealias JSONValueArray = [[String: JSONValue]]
|
||||
public typealias JSONValueObject = [String: JSONValue]
|
||||
|
||||
public enum JSONValueError: Error{
|
||||
public enum JSONValueError: Error {
|
||||
case encode
|
||||
}
|
||||
|
||||
@ -105,14 +105,14 @@ extension JSONValue: ExpressibleByDictionaryLiteral {
|
||||
}
|
||||
|
||||
extension Dictionary where Key == String, Value == Any {
|
||||
public func toJSONValue() throws -> [String:JSONValue]{
|
||||
public func toJSONValue() throws -> [String: JSONValue] {
|
||||
let data = try JSONSerialization.data(withJSONObject: self, options: .prettyPrinted)
|
||||
return try JSONDecoder().decode([String:JSONValue].self, from: data)
|
||||
}
|
||||
}
|
||||
|
||||
extension Dictionary where Key == String, Value == JSONValue {
|
||||
public func toJSONObject() throws -> JSONObject{
|
||||
public func toJSONObject() throws -> JSONObject {
|
||||
let encoded = try JSONEncoder().encode(self)
|
||||
guard let json = try JSONSerialization.jsonObject(with: encoded, options: .mutableContainers) as? JSONObject else {
|
||||
throw JSONValueError.encode
|
||||
|
||||
@ -12,7 +12,7 @@ import Foundation
|
||||
public var actionType: String?
|
||||
public var pageType: String?
|
||||
|
||||
public init(actionType: String?, pageType: String?){
|
||||
public init(actionType: String?, pageType: String?) {
|
||||
self.actionType = actionType
|
||||
self.pageType = pageType
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ import Foundation
|
||||
public var molecule: MoleculeHolder?
|
||||
public var seperator: MoleculeHolder?
|
||||
|
||||
public init(molecule: MoleculeHolder?){
|
||||
public init(molecule: MoleculeHolder?) {
|
||||
self.molecule = molecule
|
||||
self.moleculeName = Self.identifier
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ import Foundation
|
||||
public var moleculeName: String?
|
||||
public var headline: LabelModel?
|
||||
|
||||
public init(headline: LabelModel?){
|
||||
public init(headline: LabelModel?) {
|
||||
self.headline = headline
|
||||
self.moleculeName = Self.identifier
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ import Foundation
|
||||
public var molecule: MoleculeHolder?
|
||||
public var actionMap: ActionMapModel?
|
||||
|
||||
public init(molecule: MoleculeHolder?, actionMap: ActionMapModel?){
|
||||
public init(molecule: MoleculeHolder?, actionMap: ActionMapModel?) {
|
||||
self.molecule = molecule
|
||||
self.actionMap = actionMap
|
||||
self.moleculeName = Self.identifier
|
||||
|
||||
@ -13,7 +13,7 @@ import Foundation
|
||||
public var moleculeName: String?
|
||||
public var molecule: MoleculeHolder?
|
||||
|
||||
public init(molecule: MoleculeHolder?){
|
||||
public init(molecule: MoleculeHolder?) {
|
||||
self.molecule = molecule
|
||||
self.moleculeName = Self.identifier
|
||||
}
|
||||
|
||||
@ -8,13 +8,13 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
@objcMembers public class MoleculeStackModel: MoleculeProtocol{
|
||||
@objcMembers public class MoleculeStackModel: MoleculeProtocol {
|
||||
public static var identifier: String = "moleculeStack"
|
||||
public var moleculeName: String?
|
||||
public var molecules: [MoleculeStackItemModel]?
|
||||
public var axis: String?
|
||||
|
||||
public init(axis: String?, molecules: [MoleculeStackItemModel]?){
|
||||
public init(axis: String?, molecules: [MoleculeStackItemModel]?) {
|
||||
self.axis = axis
|
||||
self.molecules = molecules
|
||||
self.moleculeName = Self.identifier
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
//
|
||||
// SeperatorModel.swift
|
||||
// LineModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Suresh, Kamlesh on 10/28/19.
|
||||
@ -8,8 +8,8 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
@objcMembers public class SeperatorModel: MoleculeProtocol {
|
||||
public static var identifier: String = "seperator"
|
||||
@objcMembers public class LineModel: MoleculeProtocol {
|
||||
public static var identifier: String = "line"
|
||||
public var moleculeName: String?
|
||||
public var type: String?
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import UIKit
|
||||
public var template: String?
|
||||
public var pageType: String?
|
||||
public var screenHeading: String?
|
||||
public var isAtomicTabs: Bool = false
|
||||
public var isAtomicTabs: Bool? = false
|
||||
public var header: HeaderModel?
|
||||
public var molecules: [ListItemModel]?
|
||||
}
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
@import MVMCore.MVMCoreViewProtocol;
|
||||
//@import MVMCoreUI.Swift;
|
||||
@class MVMCoreUIDelegateObject;
|
||||
@class MVMCoreErrorObject;
|
||||
@class MoleculeProtocol;
|
||||
|
||||
@ -10,7 +10,6 @@ import Foundation
|
||||
|
||||
import UIKit
|
||||
import MVMCore.MVMCoreViewProtocol
|
||||
//@import MVMCoreUI.Swift;
|
||||
|
||||
@objc public protocol MoleculeViewProtocol: MVMCoreViewProtocol {
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ public class StandardHeaderView: ViewConstrainingView, ModelMoleculeViewProtocol
|
||||
return
|
||||
}
|
||||
|
||||
if let seperatorModel = headerModel.seperator?.object as? SeperatorModel {
|
||||
if let seperatorModel = headerModel.seperator?.object as? LineModel {
|
||||
separatorView?.setWithJSON(seperatorModel.toJSON(), delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public extension MVMCoreUIMoleculeMappingObject {
|
||||
|
||||
func createMolecule(_ model: MoleculeProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> (UIView & MVMCoreUIMoleculeViewProtocol)? {
|
||||
@ -17,11 +16,11 @@ public extension MVMCoreUIMoleculeMappingObject {
|
||||
|
||||
func createMolecule(_ model: MoleculeProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ constrainIfNeeded: Bool) -> (UIView & MVMCoreUIMoleculeViewProtocol)? {
|
||||
guard let moleculeName = model.moleculeName,
|
||||
let molecule = createMolecule(forName: moleculeName) as? MVMCoreUIViewConstrainingProtocol & UIView & MVMCoreUIMoleculeViewProtocol else {
|
||||
let molecule = createMolecule(forName: moleculeName) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
let setData = {() in
|
||||
let setData = {(molecule: UIView & MVMCoreUIMoleculeViewProtocol) in
|
||||
if let molecule = molecule as? ModelMoleculeViewProtocol {
|
||||
molecule.setWithModel(model, delegateObject, nil)
|
||||
} else {
|
||||
@ -29,12 +28,13 @@ public extension MVMCoreUIMoleculeMappingObject {
|
||||
}
|
||||
}
|
||||
|
||||
if constrainIfNeeded, molecule.needsToBeConstrained?() ?? false {
|
||||
let viewConstrainingView = ViewConstrainingView(molecule: molecule, alignment: molecule.alignment?() ?? .fill)
|
||||
setData()
|
||||
return viewConstrainingView
|
||||
if constrainIfNeeded, let castMolecule = molecule as? MVMCoreUIViewConstrainingProtocol, castMolecule.needsToBeConstrained?() ?? false {
|
||||
let view = ViewConstrainingView(molecule: molecule, alignment: castMolecule.alignment?() ?? .fill)
|
||||
setData(view)
|
||||
return view
|
||||
} else {
|
||||
setData(molecule)
|
||||
return molecule
|
||||
}
|
||||
setData()
|
||||
return molecule
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,6 @@ import Foundation
|
||||
HolderManager.register(ListItemModel.self)
|
||||
HolderManager.register(MoleculeStackItemModel.self)
|
||||
HolderManager.register(TextFieldModel.self)
|
||||
HolderManager.register(SeperatorModel.self)
|
||||
HolderManager.register(LineModel.self)
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,10 +73,16 @@
|
||||
}
|
||||
|
||||
+ (nullable instancetype)sharedMappingObject {
|
||||
[MVMCoreUIMoleculeMappingObject registerObjects];
|
||||
return [MVMCoreActionUtility initializerClassCheck:[MVMCoreUIObject sharedInstance].moleculeMap classToVerify:self];
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
[MVMCoreUIMoleculeMappingObject registerObjects];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (nullable Class)getMoleculeClassWithJSON:(nonnull NSDictionary *)json {
|
||||
NSString *moleculeName = [json string:KeyMoleculeName];
|
||||
if (moleculeName) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user