diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index edd1fe38..d97e55ac 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -63,6 +63,8 @@ EAA5EEAB28EB3ED9003B3210 /* EntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA5EEAA28EB3ED9003B3210 /* EntryFieldModel.swift */; }; EAA5EEB128EB6A5A003B3210 /* TextEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA5EEB028EB6A5A003B3210 /* TextEntryFieldModel.swift */; }; EAA5EEB328EB6A66003B3210 /* TextEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA5EEB228EB6A66003B3210 /* TextEntryField.swift */; }; + EAA5EEB528ECBFB4003B3210 /* SystemImageLabelAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA5EEB428ECBFB4003B3210 /* SystemImageLabelAttribute.swift */; }; + EAA5EEB728ECC03A003B3210 /* ToolTipLabelAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA5EEB628ECC03A003B3210 /* ToolTipLabelAttribute.swift */; }; EAB1D29A28A5611D00DAE764 /* SelectorGroupModelable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D29928A5611D00DAE764 /* SelectorGroupModelable.swift */; }; EAB1D29C28A5618900DAE764 /* RadioButtonGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D29B28A5618900DAE764 /* RadioButtonGroup.swift */; }; EAB1D29E28A5619500DAE764 /* RadioButtonGroupModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D29D28A5619500DAE764 /* RadioButtonGroupModel.swift */; }; @@ -81,11 +83,11 @@ EAF7F0A2289AFB3900B287F5 /* Errorable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0A1289AFB3900B287F5 /* Errorable.swift */; }; EAF7F0A4289B017C00B287F5 /* LabelAttributeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0A3289B017C00B287F5 /* LabelAttributeModel.swift */; }; EAF7F0A6289B0CE000B287F5 /* Resetable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0A5289B0CE000B287F5 /* Resetable.swift */; }; - EAF7F0AB289B13FD00B287F5 /* LabelAttributeFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0AA289B13FD00B287F5 /* LabelAttributeFont.swift */; }; - EAF7F0AD289B142900B287F5 /* LabelAttributeStrikeThrough.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0AC289B142900B287F5 /* LabelAttributeStrikeThrough.swift */; }; - EAF7F0AF289B144C00B287F5 /* LabelAttributeUnderline.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0AE289B144C00B287F5 /* LabelAttributeUnderline.swift */; }; - EAF7F0B1289B177F00B287F5 /* LabelAttributeColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0B0289B177F00B287F5 /* LabelAttributeColor.swift */; }; - EAF7F0B3289B1ADC00B287F5 /* LabelAttributeAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0B2289B1ADC00B287F5 /* LabelAttributeAction.swift */; }; + EAF7F0AB289B13FD00B287F5 /* FontLabelAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0AA289B13FD00B287F5 /* FontLabelAttribute.swift */; }; + EAF7F0AD289B142900B287F5 /* StrikeThroughLabelAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0AC289B142900B287F5 /* StrikeThroughLabelAttribute.swift */; }; + EAF7F0AF289B144C00B287F5 /* UnderlineLabelAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0AE289B144C00B287F5 /* UnderlineLabelAttribute.swift */; }; + EAF7F0B1289B177F00B287F5 /* ColorLabelAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0B0289B177F00B287F5 /* ColorLabelAttribute.swift */; }; + EAF7F0B3289B1ADC00B287F5 /* ActionLabelAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0B2289B1ADC00B287F5 /* ActionLabelAttribute.swift */; }; 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 */; }; @@ -95,7 +97,7 @@ EAF7F0FB289DB1AC00B287F5 /* VDSColorTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0E9289DB0DA00B287F5 /* VDSColorTokens.xcframework */; }; EAF7F11728A1475A00B287F5 /* RadioButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F11528A1475A00B287F5 /* RadioButton.swift */; }; EAF7F11828A1475A00B287F5 /* RadioButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F11628A1475A00B287F5 /* RadioButtonModel.swift */; }; - EAF7F13328A2A16500B287F5 /* LabelAttributeAttachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F13228A2A16500B287F5 /* LabelAttributeAttachment.swift */; }; + EAF7F13328A2A16500B287F5 /* AttachmentLabelAttributeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F13228A2A16500B287F5 /* AttachmentLabelAttributeModel.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -169,6 +171,8 @@ EAA5EEAA28EB3ED9003B3210 /* EntryFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntryFieldModel.swift; sourceTree = ""; }; EAA5EEB028EB6A5A003B3210 /* TextEntryFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextEntryFieldModel.swift; sourceTree = ""; }; EAA5EEB228EB6A66003B3210 /* TextEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextEntryField.swift; sourceTree = ""; }; + EAA5EEB428ECBFB4003B3210 /* SystemImageLabelAttribute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemImageLabelAttribute.swift; sourceTree = ""; }; + EAA5EEB628ECC03A003B3210 /* ToolTipLabelAttribute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolTipLabelAttribute.swift; sourceTree = ""; }; EAB1D29928A5611D00DAE764 /* SelectorGroupModelable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectorGroupModelable.swift; sourceTree = ""; }; EAB1D29B28A5618900DAE764 /* RadioButtonGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtonGroup.swift; sourceTree = ""; }; EAB1D29D28A5619500DAE764 /* RadioButtonGroupModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtonGroupModel.swift; sourceTree = ""; }; @@ -187,11 +191,11 @@ EAF7F0A1289AFB3900B287F5 /* Errorable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Errorable.swift; sourceTree = ""; }; EAF7F0A3289B017C00B287F5 /* LabelAttributeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelAttributeModel.swift; sourceTree = ""; }; EAF7F0A5289B0CE000B287F5 /* Resetable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Resetable.swift; sourceTree = ""; }; - EAF7F0AA289B13FD00B287F5 /* LabelAttributeFont.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelAttributeFont.swift; sourceTree = ""; }; - EAF7F0AC289B142900B287F5 /* LabelAttributeStrikeThrough.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelAttributeStrikeThrough.swift; sourceTree = ""; }; - EAF7F0AE289B144C00B287F5 /* LabelAttributeUnderline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelAttributeUnderline.swift; sourceTree = ""; }; - EAF7F0B0289B177F00B287F5 /* LabelAttributeColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelAttributeColor.swift; sourceTree = ""; }; - EAF7F0B2289B1ADC00B287F5 /* LabelAttributeAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelAttributeAction.swift; sourceTree = ""; }; + EAF7F0AA289B13FD00B287F5 /* FontLabelAttribute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontLabelAttribute.swift; sourceTree = ""; }; + EAF7F0AC289B142900B287F5 /* StrikeThroughLabelAttribute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StrikeThroughLabelAttribute.swift; sourceTree = ""; }; + EAF7F0AE289B144C00B287F5 /* UnderlineLabelAttribute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnderlineLabelAttribute.swift; sourceTree = ""; }; + EAF7F0B0289B177F00B287F5 /* ColorLabelAttribute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorLabelAttribute.swift; sourceTree = ""; }; + EAF7F0B2289B1ADC00B287F5 /* ActionLabelAttribute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionLabelAttribute.swift; sourceTree = ""; }; 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 = ""; }; @@ -202,7 +206,7 @@ EAF7F0EB289DB0DA00B287F5 /* VDSLayoutTokens.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = VDSLayoutTokens.xcframework; path = ../SharedFrameworks/VDSLayoutTokens.xcframework; sourceTree = ""; }; EAF7F11528A1475A00B287F5 /* RadioButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RadioButton.swift; sourceTree = ""; }; EAF7F11628A1475A00B287F5 /* RadioButtonModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RadioButtonModel.swift; sourceTree = ""; }; - EAF7F13228A2A16500B287F5 /* LabelAttributeAttachment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelAttributeAttachment.swift; sourceTree = ""; }; + EAF7F13228A2A16500B287F5 /* AttachmentLabelAttributeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentLabelAttributeModel.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -522,12 +526,14 @@ isa = PBXGroup; children = ( EAF7F0A3289B017C00B287F5 /* LabelAttributeModel.swift */, - EAF7F0B2289B1ADC00B287F5 /* LabelAttributeAction.swift */, - EAF7F13228A2A16500B287F5 /* LabelAttributeAttachment.swift */, - EAF7F0B0289B177F00B287F5 /* LabelAttributeColor.swift */, - EAF7F0AA289B13FD00B287F5 /* LabelAttributeFont.swift */, - EAF7F0AC289B142900B287F5 /* LabelAttributeStrikeThrough.swift */, - EAF7F0AE289B144C00B287F5 /* LabelAttributeUnderline.swift */, + EAF7F0B2289B1ADC00B287F5 /* ActionLabelAttribute.swift */, + EAF7F13228A2A16500B287F5 /* AttachmentLabelAttributeModel.swift */, + EAF7F0B0289B177F00B287F5 /* ColorLabelAttribute.swift */, + EAF7F0AA289B13FD00B287F5 /* FontLabelAttribute.swift */, + EAF7F0AC289B142900B287F5 /* StrikeThroughLabelAttribute.swift */, + EAA5EEB428ECBFB4003B3210 /* SystemImageLabelAttribute.swift */, + EAF7F0AE289B144C00B287F5 /* UnderlineLabelAttribute.swift */, + EAA5EEB628ECC03A003B3210 /* ToolTipLabelAttribute.swift */, ); path = Attributes; sourceTree = ""; @@ -668,10 +674,11 @@ EA89201328B568D8006B9984 /* RadioBox.swift in Sources */, EA84F6B128B94A2500D67ABC /* CodableColor.swift in Sources */, EA3362402892EF6C0071C351 /* Label.swift in Sources */, - EAF7F0B3289B1ADC00B287F5 /* LabelAttributeAction.swift in Sources */, + EAF7F0B3289B1ADC00B287F5 /* ActionLabelAttribute.swift in Sources */, EA33622E2891EA3C0071C351 /* DispatchQueue+Once.swift in Sources */, EA4DB2FD28D3D0CA00103EE3 /* AnyEquatable.swift in Sources */, - EAF7F0AF289B144C00B287F5 /* LabelAttributeUnderline.swift in Sources */, + EAA5EEB728ECC03A003B3210 /* ToolTipLabelAttribute.swift in Sources */, + EAF7F0AF289B144C00B287F5 /* UnderlineLabelAttribute.swift in Sources */, EA3361C5289030FC0071C351 /* Accessable.swift in Sources */, EA33622C2891E73B0071C351 /* FontProtocol.swift in Sources */, EAA5EEAB28EB3ED9003B3210 /* EntryFieldModel.swift in Sources */, @@ -688,9 +695,9 @@ EA3362432892EFF20071C351 /* LabelModel.swift in Sources */, EA33624728931B050071C351 /* Initable.swift in Sources */, EAF7F0A4289B017C00B287F5 /* LabelAttributeModel.swift in Sources */, - EAF7F0B1289B177F00B287F5 /* LabelAttributeColor.swift in Sources */, + EAF7F0B1289B177F00B287F5 /* ColorLabelAttribute.swift in Sources */, EAB1D2EA28AE84AA00DAE764 /* UIControlPublisher.swift in Sources */, - EAF7F13328A2A16500B287F5 /* LabelAttributeAttachment.swift in Sources */, + EAF7F13328A2A16500B287F5 /* AttachmentLabelAttributeModel.swift in Sources */, EA89200628B526D6006B9984 /* CheckboxGroup.swift in Sources */, EAD8D2C128BFDE8B006EB6A6 /* UIGestureRecognizer+Publisher.swift in Sources */, EAF7F0B9289C139800B287F5 /* ColorConfiguration.swift in Sources */, @@ -712,9 +719,10 @@ EA1F266528B945070033E859 /* RadioSwatch.swift in Sources */, EA4DB18528CA967F00103EE3 /* SelectorGroupHandlerBase.swift in Sources */, EA89200228AECF2A006B9984 /* UIButton+Publisher.swift in Sources */, - EAF7F0AB289B13FD00B287F5 /* LabelAttributeFont.swift in Sources */, + EAF7F0AB289B13FD00B287F5 /* FontLabelAttribute.swift in Sources */, EAB1D29C28A5618900DAE764 /* RadioButtonGroup.swift in Sources */, EA336171288B19200071C351 /* VDS.docc in Sources */, + EAA5EEB528ECBFB4003B3210 /* SystemImageLabelAttribute.swift in Sources */, EAF7F0962899861000B287F5 /* CheckboxModel.swift in Sources */, EAB1D2E628AE842000DAE764 /* Publisher+Bind.swift in Sources */, EA3361AA288B25E40071C351 /* Disabling.swift in Sources */, @@ -728,7 +736,7 @@ EA33623E2892EE950071C351 /* UIDevice.swift in Sources */, EA3362302891EB4A0071C351 /* Fonts.swift in Sources */, EA1F265E28B944F00033E859 /* CollectionViewCell.swift in Sources */, - EAF7F0AD289B142900B287F5 /* LabelAttributeStrikeThrough.swift in Sources */, + EAF7F0AD289B142900B287F5 /* StrikeThroughLabelAttribute.swift in Sources */, EA3361B8288B2AAA0071C351 /* ViewProtocol.swift in Sources */, EA3361BF288B2EA60071C351 /* ModelHandlerable.swift in Sources */, EA3361A8288B23300071C351 /* UIColor.swift in Sources */, @@ -880,7 +888,6 @@ EA336181288B19210071C351 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - BITCODE_GENERATION_MODE = bitcode; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -888,7 +895,6 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_BITCODE = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = ""; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; @@ -913,7 +919,6 @@ EA336182288B19210071C351 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - BITCODE_GENERATION_MODE = bitcode; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -921,7 +926,6 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_BITCODE = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = ""; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; diff --git a/VDS/Components/Label/Attributes/LabelAttributeAction.swift b/VDS/Components/Label/Attributes/ActionLabelAttribute.swift similarity index 82% rename from VDS/Components/Label/Attributes/LabelAttributeAction.swift rename to VDS/Components/Label/Attributes/ActionLabelAttribute.swift index 7e280a42..fe3b2012 100644 --- a/VDS/Components/Label/Attributes/LabelAttributeAction.swift +++ b/VDS/Components/Label/Attributes/ActionLabelAttribute.swift @@ -9,18 +9,18 @@ import Foundation import UIKit import Combine -public protocol LabelAttributeActionable: LabelAttributeModel { +public protocol ActionLabelAttributeModel: LabelAttributeModel { var accessibleText: String? { get set } var action: PassthroughSubject { get set } } -public struct LabelAttributeActionModel: LabelAttributeActionable { +public struct ActionLabelAttribute: ActionLabelAttributeModel { - public static func == (lhs: LabelAttributeActionModel, rhs: LabelAttributeActionModel) -> Bool { + public static func == (lhs: ActionLabelAttribute, rhs: ActionLabelAttribute) -> Bool { lhs.isEqual(rhs) } - public func isEqual(_ equatable: LabelAttributeActionModel) -> Bool { + public func isEqual(_ equatable: ActionLabelAttribute) -> Bool { return id == equatable.id && range == equatable.range } diff --git a/VDS/Components/Label/Attributes/LabelAttributeAttachment.swift b/VDS/Components/Label/Attributes/AttachmentLabelAttributeModel.swift similarity index 84% rename from VDS/Components/Label/Attributes/LabelAttributeAttachment.swift rename to VDS/Components/Label/Attributes/AttachmentLabelAttributeModel.swift index 35008d14..5de6f4b2 100644 --- a/VDS/Components/Label/Attributes/LabelAttributeAttachment.swift +++ b/VDS/Components/Label/Attributes/AttachmentLabelAttributeModel.swift @@ -8,11 +8,11 @@ import Foundation import UIKit -public protocol LabelAttributeAttachment: LabelAttributeModel { +public protocol AttachmentLabelAttributeModel: LabelAttributeModel { func getAttachment() throws -> NSTextAttachment } -extension LabelAttributeAttachment { +extension AttachmentLabelAttributeModel { public func setAttribute(on attributedString: NSMutableAttributedString) { do { let mutableString = NSMutableAttributedString() diff --git a/VDS/Components/Label/Attributes/LabelAttributeColor.swift b/VDS/Components/Label/Attributes/ColorLabelAttribute.swift similarity index 89% rename from VDS/Components/Label/Attributes/LabelAttributeColor.swift rename to VDS/Components/Label/Attributes/ColorLabelAttribute.swift index 6d3f35aa..8d70296d 100644 --- a/VDS/Components/Label/Attributes/LabelAttributeColor.swift +++ b/VDS/Components/Label/Attributes/ColorLabelAttribute.swift @@ -8,8 +8,8 @@ import Foundation import UIKit -public struct LabelAttributeColor: LabelAttributeModel { - public func isEqual(_ equatable: LabelAttributeColor) -> Bool { +public struct ColorLabelAttribute: LabelAttributeModel { + public func isEqual(_ equatable: ColorLabelAttribute) -> Bool { return id == equatable.id && range == equatable.range && color == equatable.color } //-------------------------------------------------- diff --git a/VDS/Components/Label/Attributes/LabelAttributeFont.swift b/VDS/Components/Label/Attributes/FontLabelAttribute.swift similarity index 91% rename from VDS/Components/Label/Attributes/LabelAttributeFont.swift rename to VDS/Components/Label/Attributes/FontLabelAttribute.swift index af559184..6456b76c 100644 --- a/VDS/Components/Label/Attributes/LabelAttributeFont.swift +++ b/VDS/Components/Label/Attributes/FontLabelAttribute.swift @@ -8,8 +8,8 @@ import Foundation import UIKit -public struct LabelAttributeFont: LabelAttributeModel { - public func isEqual(_ equatable: LabelAttributeFont) -> Bool { +public struct FontLabelAttribute: LabelAttributeModel { + public func isEqual(_ equatable: FontLabelAttribute) -> Bool { return id == equatable.id && range == equatable.range && color == equatable.color diff --git a/VDS/Components/Label/Attributes/LabelAttributeStrikeThrough.swift b/VDS/Components/Label/Attributes/StrikeThroughLabelAttribute.swift similarity index 84% rename from VDS/Components/Label/Attributes/LabelAttributeStrikeThrough.swift rename to VDS/Components/Label/Attributes/StrikeThroughLabelAttribute.swift index 6b62691c..93650f2b 100644 --- a/VDS/Components/Label/Attributes/LabelAttributeStrikeThrough.swift +++ b/VDS/Components/Label/Attributes/StrikeThroughLabelAttribute.swift @@ -8,8 +8,8 @@ import Foundation import UIKit -public struct LabelAttributeStrikeThrough: LabelAttributeModel { - public func isEqual(_ equatable: LabelAttributeStrikeThrough) -> Bool { +public struct StrikeThroughLabelAttribute: LabelAttributeModel { + public func isEqual(_ equatable: StrikeThroughLabelAttribute) -> Bool { return id == equatable.id && range == equatable.range } diff --git a/VDS/Components/Label/Attributes/SystemImageLabelAttribute.swift b/VDS/Components/Label/Attributes/SystemImageLabelAttribute.swift new file mode 100644 index 00000000..6f3bf3a2 --- /dev/null +++ b/VDS/Components/Label/Attributes/SystemImageLabelAttribute.swift @@ -0,0 +1,32 @@ +// +// LabelSystemImageLabelAttribute.swift +// VDS +// +// Created by Matt Bruce on 10/4/22. +// + +import Foundation +import UIKit + +public struct SystemImageLabelAttribute: AttachmentLabelAttributeModel { + public var id = UUID() + public var location: Int + public var length: Int + public var imageName: String + public var frame: CGRect + public var tintColor: UIColor + public static func == (lhs: SystemImageLabelAttribute, rhs: SystemImageLabelAttribute) -> Bool { + lhs.isEqual(rhs) + } + + public func isEqual(_ equatable: SystemImageLabelAttribute) -> Bool { + return id == equatable.id && range == equatable.range && imageName == equatable.imageName + } + + public func getAttachment() throws -> NSTextAttachment { + let attachment = NSTextAttachment() + attachment.image = UIImage(systemName: imageName)?.withTintColor(tintColor) + attachment.bounds = frame + return attachment + } +} diff --git a/VDS/Components/Label/Attributes/ToolTipLabelAttribute.swift b/VDS/Components/Label/Attributes/ToolTipLabelAttribute.swift new file mode 100644 index 00000000..8bb16199 --- /dev/null +++ b/VDS/Components/Label/Attributes/ToolTipLabelAttribute.swift @@ -0,0 +1,39 @@ +// +// ToolTipLabelAttribute.swift +// VDS +// +// Created by Matt Bruce on 10/4/22. +// + +import Foundation +import UIKit +import Combine + +public struct ToolTipLabelAttribute: ActionLabelAttributeModel { + public var id = UUID() + public var accessibleText: String? = "Tool Tip" + public var action = PassthroughSubject() + public var location: Int + public var length: Int + public var tintColor: UIColor + + public func setAttribute(on attributedString: NSMutableAttributedString) { + let image = SystemImageLabelAttribute(location: location, + length: length, + imageName: "info.circle", + frame: .init(x: 0, y: -2, width: 13.3, height: 13.3), + tintColor: tintColor) + + image.setAttribute(on: attributedString) + + } + + public static func == (lhs: ToolTipLabelAttribute, rhs: ToolTipLabelAttribute) -> Bool { + lhs.isEqual(rhs) + } + + public func isEqual(_ equatable: ToolTipLabelAttribute) -> Bool { + return id == equatable.id && range == equatable.range + } +} + diff --git a/VDS/Components/Label/Attributes/LabelAttributeUnderline.swift b/VDS/Components/Label/Attributes/UnderlineLabelAttribute.swift similarity index 95% rename from VDS/Components/Label/Attributes/LabelAttributeUnderline.swift rename to VDS/Components/Label/Attributes/UnderlineLabelAttribute.swift index d7c302cc..98ed45a2 100644 --- a/VDS/Components/Label/Attributes/LabelAttributeUnderline.swift +++ b/VDS/Components/Label/Attributes/UnderlineLabelAttribute.swift @@ -8,9 +8,9 @@ import Foundation import UIKit -public struct LabelAttributeUnderline: LabelAttributeModel { +public struct UnderlineLabelAttribute: LabelAttributeModel { - public func isEqual(_ equatable: LabelAttributeUnderline) -> Bool { + public func isEqual(_ equatable: UnderlineLabelAttribute) -> Bool { return id == equatable.id && range == equatable.range && color == equatable.color diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index 8dae7755..9ebfc020 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -159,7 +159,7 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt attribute.setAttribute(on: mutableText) //see if the attribute is Actionable - if let actionable = attribute as? any LabelAttributeActionable{ + if let actionable = attribute as? any ActionLabelAttributeModel{ //create a accessibleAction let customAccessibilityAction = customAccessibilityAction(range: actionable.range, accessibleText: actionable.accessibleText) diff --git a/VDS/Components/TextFields/EntryField/EntryField.swift b/VDS/Components/TextFields/EntryField/EntryField.swift index e8643ecb..bae1fc76 100644 --- a/VDS/Components/TextFields/EntryField/EntryField.swift +++ b/VDS/Components/TextFields/EntryField/EntryField.swift @@ -293,7 +293,7 @@ open class EntryField: Control { extension DefaultLabelModel { public func addOptional(required: Bool, colorConfiguration: DisabledSurfaceColorConfiguration) -> DefaultLabelModel { guard let text = text, !required else { return self} - let optionColorAttr = LabelAttributeColor(location: text.count + 2, + let optionColorAttr = ColorLabelAttribute(location: text.count + 2, length: 8, color: colorConfiguration.getColor(self)) @@ -319,53 +319,3 @@ extension DefaultLabelModel { } } } - -public struct LabelSystemImageAttachement: LabelAttributeAttachment { - public var id = UUID() - public var location: Int - public var length: Int - public var imageName: String - public var frame: CGRect - public var tintColor: UIColor - public static func == (lhs: LabelSystemImageAttachement, rhs: LabelSystemImageAttachement) -> Bool { - lhs.isEqual(rhs) - } - - public func isEqual(_ equatable: LabelSystemImageAttachement) -> Bool { - return id == equatable.id && range == equatable.range && imageName == equatable.imageName - } - - public func getAttachment() throws -> NSTextAttachment { - let attachment = NSTextAttachment() - attachment.image = UIImage(systemName: imageName)?.withTintColor(tintColor) - attachment.bounds = frame - return attachment - } -} - -public struct ToolTipLabelAttribute: LabelAttributeActionable { - public var id = UUID() - public var accessibleText: String? = "Tool Tip" - public var action = PassthroughSubject() - public var location: Int - public var length: Int - public var tintColor: UIColor - public func setAttribute(on attributedString: NSMutableAttributedString) { - let image = LabelSystemImageAttachement(location: location, - length: length, - imageName: "info.circle", - frame: .init(x: 0, y: -2, width: 13.3, height: 13.3), - tintColor: tintColor) - - image.setAttribute(on: attributedString) - - } - - public static func == (lhs: ToolTipLabelAttribute, rhs: ToolTipLabelAttribute) -> Bool { - lhs.isEqual(rhs) - } - - public func isEqual(_ equatable: ToolTipLabelAttribute) -> Bool { - return id == equatable.id && range == equatable.range - } -}