diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index 472f2040..3ec4ffa2 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -58,6 +58,8 @@ EAF7F0B5289C126F00B287F5 /* UILabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0B4289C126F00B287F5 /* UILabel.swift */; }; EAF7F0B7289C12A600B287F5 /* UITapGestureRecognizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0B6289C12A600B287F5 /* UITapGestureRecognizer.swift */; }; EAF7F0B9289C139800B287F5 /* ColorConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0B8289C139800B287F5 /* ColorConfiguration.swift */; }; + EAF7F0BB289D80ED00B287F5 /* Modelable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0BA289D80ED00B287F5 /* Modelable.swift */; }; + EAF7F0BD289D81B100B287F5 /* FontStyleable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0BC289D81B100B287F5 /* FontStyleable.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -123,6 +125,8 @@ EAF7F0B4289C126F00B287F5 /* UILabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UILabel.swift; sourceTree = ""; }; EAF7F0B6289C12A600B287F5 /* UITapGestureRecognizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITapGestureRecognizer.swift; sourceTree = ""; }; EAF7F0B8289C139800B287F5 /* ColorConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorConfiguration.swift; sourceTree = ""; }; + EAF7F0BA289D80ED00B287F5 /* Modelable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Modelable.swift; sourceTree = ""; }; + EAF7F0BC289D81B100B287F5 /* FontStyleable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontStyleable.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -241,9 +245,11 @@ EA3361A9288B25E40071C351 /* Disabling.swift */, EAF7F0A1289AFB3900B287F5 /* Errorable.swift */, EAF7F0A7289B119400B287F5 /* Fontable.swift */, + EAF7F0BC289D81B100B287F5 /* FontStyleable.swift */, EA3361AE288B26310071C351 /* FormFieldable.swift */, EA33624628931B050071C351 /* Initable.swift */, EA3362442892F9130071C351 /* Labelable.swift */, + EAF7F0BA289D80ED00B287F5 /* Modelable.swift */, EA3361BE288B2EA60071C351 /* ModelHandlerable.swift */, EA3361C8289054C50071C351 /* Surfaceable.swift */, EA3361B7288B2AAA0071C351 /* ViewProtocol.swift */, @@ -471,6 +477,7 @@ EA3C3B4C2894823E000CA526 /* AnyProxy-PropertyWrapper.swift in Sources */, EA3361AF288B26310071C351 /* FormFieldable.swift in Sources */, EAF7F0A8289B119400B287F5 /* Fontable.swift in Sources */, + EAF7F0BB289D80ED00B287F5 /* Modelable.swift in Sources */, EAF7F09E289AAEC000B287F5 /* Constants.swift in Sources */, EA3361B3288B265D0071C351 /* Changable.swift in Sources */, EAF7F0AB289B13FD00B287F5 /* LabelAttributeFont.swift in Sources */, @@ -483,6 +490,7 @@ EA3361AD288B26190071C351 /* DataTrackable.swift in Sources */, EA33623E2892EE950071C351 /* UIDevice.swift in Sources */, EA3362302891EB4A0071C351 /* Fonts.swift in Sources */, + EAF7F0BD289D81B100B287F5 /* FontStyleable.swift in Sources */, EAF7F0AD289B142900B287F5 /* LabelAttributeStrikeThrough.swift in Sources */, EA3361B8288B2AAA0071C351 /* ViewProtocol.swift in Sources */, EA3361BF288B2EA60071C351 /* ModelHandlerable.swift in Sources */, diff --git a/VDS/Classes/Control.swift b/VDS/Classes/Control.swift index 1c0b0422..a41ec717 100644 --- a/VDS/Classes/Control.swift +++ b/VDS/Classes/Control.swift @@ -10,7 +10,7 @@ import UIKit import Combine -open class Control: UIControl, ModelHandlerable, ViewProtocol, Resettable { +open class Control: UIControl, ModelHandlerable, ViewProtocol, Resettable { @Published public var model: ModelType private var cancellable: AnyCancellable? diff --git a/VDS/Classes/View.swift b/VDS/Classes/View.swift index 06a55579..6c18736d 100644 --- a/VDS/Classes/View.swift +++ b/VDS/Classes/View.swift @@ -10,7 +10,7 @@ import UIKit import Combine -open class View: UIView, ModelHandlerable, ViewProtocol, Resettable { +open class View: UIView, ModelHandlerable, ViewProtocol, Resettable { @Published public var model: ModelType private var cancellable: AnyCancellable? diff --git a/VDS/Components/Checkbox/CheckboxModel.swift b/VDS/Components/Checkbox/CheckboxModel.swift index 71e36a3d..3d686404 100644 --- a/VDS/Components/Checkbox/CheckboxModel.swift +++ b/VDS/Components/Checkbox/CheckboxModel.swift @@ -8,7 +8,7 @@ import Foundation import UIKit -public protocol CheckboxModel: FormFieldable, Errorable, DataTrackable, Accessable, Surfaceable, Disabling, Initable, BinaryColorable { +public protocol CheckboxModel: Modelable, FormFieldable, Errorable, DataTrackable, Accessable, BinaryColorable { var id: String? { get set } var on: Bool { get set } var labelText: String? { get set } diff --git a/VDS/Components/Label/LabelModel.swift b/VDS/Components/Label/LabelModel.swift index 2d73f619..e8a7e750 100644 --- a/VDS/Components/Label/LabelModel.swift +++ b/VDS/Components/Label/LabelModel.swift @@ -8,7 +8,7 @@ import Foundation import UIKit -public protocol LabelModel: Labelable, Surfaceable, Disabling, Initable { +public protocol LabelModel: Modelable, Labelable { var text: String? { get set } var attributes: [LabelAttributeModel]? { get set } } diff --git a/VDS/Components/Toggle/ToggleModel.swift b/VDS/Components/Toggle/ToggleModel.swift index 7023451f..9c5cd794 100644 --- a/VDS/Components/Toggle/ToggleModel.swift +++ b/VDS/Components/Toggle/ToggleModel.swift @@ -8,7 +8,7 @@ import Foundation import UIKit -public protocol ToggleModel: FormFieldable, DataTrackable, Accessable, Initable, Labelable, Surfaceable, Disabling, BinaryColorable { +public protocol ToggleModel: Modelable, FormFieldable, DataTrackable, Accessable, Labelable, BinaryColorable { var id: String? { get set } var showText: Bool { get set } var on: Bool { get set } diff --git a/VDS/Protocols/FontStyleable.swift b/VDS/Protocols/FontStyleable.swift new file mode 100644 index 00000000..9ae23ee1 --- /dev/null +++ b/VDS/Protocols/FontStyleable.swift @@ -0,0 +1,12 @@ +// +// FontStyleable.swift +// VDS +// +// Created by Matt Bruce on 8/5/22. +// + +import Foundation + +public protocol FontStyleable { + var fontStyle: FontStyle { get set } +} diff --git a/VDS/Protocols/Fontable.swift b/VDS/Protocols/Fontable.swift index 493b2deb..19d90dc6 100644 --- a/VDS/Protocols/Fontable.swift +++ b/VDS/Protocols/Fontable.swift @@ -16,11 +16,11 @@ public protocol Fontable { extension Fontable { - var style: FontStyle? { + var fontStyle: FontStyle? { return try? FontStyle.style(for: fontCategory, fontWeight: fontWeight, fontSize: fontSize) } var font: UIFont? { - return self.style?.font + return fontStyle?.font } } diff --git a/VDS/Protocols/ModelHandlerable.swift b/VDS/Protocols/ModelHandlerable.swift index 1e8bd38a..3943ff61 100644 --- a/VDS/Protocols/ModelHandlerable.swift +++ b/VDS/Protocols/ModelHandlerable.swift @@ -8,7 +8,7 @@ import Foundation public protocol ModelHandlerable { - associatedtype ModelType + associatedtype ModelType: Modelable var model: ModelType { get set } init(with model: ModelType) func set(with model: ModelType) diff --git a/VDS/Protocols/Modelable.swift b/VDS/Protocols/Modelable.swift new file mode 100644 index 00000000..94eaf06e --- /dev/null +++ b/VDS/Protocols/Modelable.swift @@ -0,0 +1,12 @@ +// +// Modelable.swift +// VDS +// +// Created by Matt Bruce on 8/5/22. +// + +import Foundation + +public protocol Modelable: Surfaceable, Disabling, Initable { + +}