moved structs into own file
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
98968bacbd
commit
3dbdefd376
@ -44,6 +44,7 @@
|
||||
EA4DB18528CA967F00103EE3 /* SelectorGroupHandlerBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA4DB18428CA967F00103EE3 /* SelectorGroupHandlerBase.swift */; };
|
||||
EA4DB2FD28D3D0CA00103EE3 /* AnyEquatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA4DB2FC28D3D0CA00103EE3 /* AnyEquatable.swift */; };
|
||||
EA4DB30228DCBCA500103EE3 /* Badge.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA4DB30128DCBCA500103EE3 /* Badge.swift */; };
|
||||
EA513A952A4E1F82002A4DFF /* TitleLockupStyleConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA513A942A4E1F82002A4DFF /* TitleLockupStyleConfiguration.swift */; };
|
||||
EA596ABD2A16B4EC00300C4B /* Tab.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA596ABC2A16B4EC00300C4B /* Tab.swift */; };
|
||||
EA596ABF2A16B4F500300C4B /* Tabs.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA596ABE2A16B4F500300C4B /* Tabs.swift */; };
|
||||
EA5E304C294CBDD00082B959 /* TileContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5E304B294CBDD00082B959 /* TileContainer.swift */; };
|
||||
@ -177,6 +178,7 @@
|
||||
EA4DB18428CA967F00103EE3 /* SelectorGroupHandlerBase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectorGroupHandlerBase.swift; sourceTree = "<group>"; };
|
||||
EA4DB2FC28D3D0CA00103EE3 /* AnyEquatable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnyEquatable.swift; sourceTree = "<group>"; };
|
||||
EA4DB30128DCBCA500103EE3 /* Badge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Badge.swift; sourceTree = "<group>"; };
|
||||
EA513A942A4E1F82002A4DFF /* TitleLockupStyleConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleLockupStyleConfiguration.swift; sourceTree = "<group>"; };
|
||||
EA596ABC2A16B4EC00300C4B /* Tab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tab.swift; sourceTree = "<group>"; };
|
||||
EA596ABE2A16B4F500300C4B /* Tabs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tabs.swift; sourceTree = "<group>"; };
|
||||
EA5E304B294CBDD00082B959 /* TileContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TileContainer.swift; sourceTree = "<group>"; };
|
||||
@ -569,6 +571,7 @@
|
||||
EA985BED2968A92400F2FF2E /* TitleLockupSubTitleModel.swift */,
|
||||
EA985BEB2968A91200F2FF2E /* TitleLockupTitleModel.swift */,
|
||||
EA985BF12968B5BB00F2FF2E /* TitleLockupTextStyle.swift */,
|
||||
EA513A942A4E1F82002A4DFF /* TitleLockupStyleConfiguration.swift */,
|
||||
);
|
||||
path = TitleLockup;
|
||||
sourceTree = "<group>";
|
||||
@ -795,7 +798,7 @@
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastSwiftUpdateCheck = 1340;
|
||||
LastUpgradeCheck = 1340;
|
||||
LastUpgradeCheck = 1430;
|
||||
TargetAttributes = {
|
||||
EA33616B288B19200071C351 = {
|
||||
CreatedOnToolsVersion = 13.4.1;
|
||||
@ -917,6 +920,7 @@
|
||||
EAF1FE9929D4850E00101452 /* Clickable.swift in Sources */,
|
||||
EAB5FEF829393A7200998C17 /* ButtonGroupConstants.swift in Sources */,
|
||||
EA3361AF288B26310071C351 /* FormFieldable.swift in Sources */,
|
||||
EA513A952A4E1F82002A4DFF /* TitleLockupStyleConfiguration.swift in Sources */,
|
||||
44604AD729CE196600E62B51 /* Line.swift in Sources */,
|
||||
EA5E3058295105A40082B959 /* Tilelet.swift in Sources */,
|
||||
EA89201528B56CF4006B9984 /* RadioBoxGroup.swift in Sources */,
|
||||
@ -1105,6 +1109,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 25;
|
||||
DEFINES_MODULE = YES;
|
||||
@ -1112,6 +1117,7 @@
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_MODULE_VERIFIER = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../SharedFrameworks";
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
@ -1123,6 +1129,8 @@
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
|
||||
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.vzw.vds;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SKIP_INSTALL = YES;
|
||||
@ -1138,6 +1146,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 25;
|
||||
DEFINES_MODULE = YES;
|
||||
@ -1145,6 +1154,7 @@
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_MODULE_VERIFIER = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../SharedFrameworks";
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
@ -1156,6 +1166,8 @@
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
|
||||
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.vzw.vds;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SKIP_INSTALL = YES;
|
||||
|
||||
@ -294,80 +294,4 @@ open class TitleLockup: View {
|
||||
titleLabel.isHidden = titleTextIsEmpty
|
||||
subTitleLabel.isHidden = subTitleTextIsEmpty
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension TitleLockup {
|
||||
public struct StandardStyleConfigurationProvider {
|
||||
public var styleConfigurations: [StandardStyleConfiguration]
|
||||
|
||||
public init(styleConfigurations: [StandardStyleConfiguration]) {
|
||||
self.styleConfigurations = styleConfigurations
|
||||
}
|
||||
|
||||
public func configuration(for titleStandardStyle: TitleStandardStyle) -> StandardStyleConfiguration? {
|
||||
let deviceType: StandardStyleConfiguration.DeviceType = UIDevice.isIPad ? .iPad : .iPhone
|
||||
guard let config: StandardStyleConfiguration = styleConfigurations.first(where: { return titleStandardStyle.isWithin($0.titleStandardStyles) && ($0.deviceType == deviceType || $0.deviceType == .all )}) else { return nil }
|
||||
return config
|
||||
}
|
||||
|
||||
public func isValid(otherStandardStyle: OtherStandardStyle, for titleStandardStyle: TitleStandardStyle) -> Bool {
|
||||
guard let config = configuration(for: titleStandardStyle) else { return false }
|
||||
return otherStandardStyle.isWithin(config.spacingConfigurations.flatMap {$0.otherStandardStyles})
|
||||
}
|
||||
|
||||
public func spacing(for titleStandardStyle: TitleStandardStyle, otherStandardStyle: OtherStandardStyle) -> (otherStandardStyle: OtherStandardStyle, topSpacing: CGFloat, bottomSpacing: CGFloat)? {
|
||||
guard let config = configuration(for: titleStandardStyle) else { return nil }
|
||||
return config.styleSpacing(for: otherStandardStyle)
|
||||
}
|
||||
}
|
||||
|
||||
public struct StandardStyleConfiguration {
|
||||
public enum DeviceType {
|
||||
case iPhone, iPad, all
|
||||
}
|
||||
public var deviceType: DeviceType
|
||||
public var titleStandardStyles:[TitleStandardStyle]
|
||||
public var spacingConfigurations: [SpacingConfiguration]
|
||||
|
||||
public init(deviceType: DeviceType, titleStandardStyles: [TitleStandardStyle], spacingConfigurations: [SpacingConfiguration]) {
|
||||
self.deviceType = deviceType
|
||||
self.titleStandardStyles = titleStandardStyles
|
||||
self.spacingConfigurations = spacingConfigurations
|
||||
}
|
||||
|
||||
public var allOtherStandardStyles: [OtherStandardStyle] {
|
||||
spacingConfigurations.flatMap {$0.otherStandardStyles}
|
||||
}
|
||||
|
||||
public func styleSpacing(for otherStandardStyle: OtherStandardStyle) -> (otherStandardStyle: OtherStandardStyle, topSpacing: CGFloat, bottomSpacing: CGFloat) {
|
||||
//set default return other style what you pass in
|
||||
var realOtherStyle = otherStandardStyle
|
||||
|
||||
//flatten all of the other styles registered for the title styles
|
||||
let allOtherStyles = spacingConfigurations.flatMap {$0.otherStandardStyles}
|
||||
|
||||
//get the default other style incase what is passed isn't within the registered collection
|
||||
if let first = allOtherStyles.first, !realOtherStyle.isWithin(allOtherStyles) {
|
||||
realOtherStyle = first
|
||||
}
|
||||
//get the config against the other style or return defaults
|
||||
guard let styleSpacing = spacingConfigurations.first(where: {realOtherStyle.isWithin($0.otherStandardStyles)}) else {
|
||||
return (realOtherStyle, VDSLayout.Spacing.space2X.value, VDSLayout.Spacing.space2X.value)
|
||||
}
|
||||
return (realOtherStyle, styleSpacing.topSpacing, styleSpacing.bottomSpacing)
|
||||
}
|
||||
}
|
||||
|
||||
public struct SpacingConfiguration {
|
||||
public var otherStandardStyles: [OtherStandardStyle]
|
||||
public var topSpacing: CGFloat
|
||||
public var bottomSpacing: CGFloat
|
||||
|
||||
public init(otherStandardStyles: [OtherStandardStyle], topSpacing: CGFloat, bottomSpacing: CGFloat) {
|
||||
self.otherStandardStyles = otherStandardStyles
|
||||
self.topSpacing = topSpacing
|
||||
self.bottomSpacing = bottomSpacing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,85 @@
|
||||
//
|
||||
// TitleLockupStandardStyleConfiguration.swift
|
||||
// VDS
|
||||
//
|
||||
// Created by Matt Bruce on 6/29/23.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
extension TitleLockup {
|
||||
|
||||
public struct StandardStyleConfigurationProvider {
|
||||
public var styleConfigurations: [StandardStyleConfiguration]
|
||||
|
||||
public init(styleConfigurations: [StandardStyleConfiguration]) {
|
||||
self.styleConfigurations = styleConfigurations
|
||||
}
|
||||
|
||||
public func configuration(for titleStandardStyle: TitleStandardStyle) -> StandardStyleConfiguration? {
|
||||
let deviceType: StandardStyleConfiguration.DeviceType = UIDevice.isIPad ? .iPad : .iPhone
|
||||
guard let config: StandardStyleConfiguration = styleConfigurations.first(where: { return titleStandardStyle.isWithin($0.titleStandardStyles) && ($0.deviceType == deviceType || $0.deviceType == .all )}) else { return nil }
|
||||
return config
|
||||
}
|
||||
|
||||
public func isValid(otherStandardStyle: OtherStandardStyle, for titleStandardStyle: TitleStandardStyle) -> Bool {
|
||||
guard let config = configuration(for: titleStandardStyle) else { return false }
|
||||
return otherStandardStyle.isWithin(config.spacingConfigurations.flatMap {$0.otherStandardStyles})
|
||||
}
|
||||
|
||||
public func spacing(for titleStandardStyle: TitleStandardStyle, otherStandardStyle: OtherStandardStyle) -> (otherStandardStyle: OtherStandardStyle, topSpacing: CGFloat, bottomSpacing: CGFloat)? {
|
||||
guard let config = configuration(for: titleStandardStyle) else { return nil }
|
||||
return config.styleSpacing(for: otherStandardStyle)
|
||||
}
|
||||
}
|
||||
|
||||
public struct StandardStyleConfiguration {
|
||||
public enum DeviceType {
|
||||
case iPhone, iPad, all
|
||||
}
|
||||
public var deviceType: DeviceType
|
||||
public var titleStandardStyles:[TitleStandardStyle]
|
||||
public var spacingConfigurations: [SpacingConfiguration]
|
||||
|
||||
public init(deviceType: DeviceType, titleStandardStyles: [TitleStandardStyle], spacingConfigurations: [SpacingConfiguration]) {
|
||||
self.deviceType = deviceType
|
||||
self.titleStandardStyles = titleStandardStyles
|
||||
self.spacingConfigurations = spacingConfigurations
|
||||
}
|
||||
|
||||
public var allOtherStandardStyles: [OtherStandardStyle] {
|
||||
spacingConfigurations.flatMap {$0.otherStandardStyles}
|
||||
}
|
||||
|
||||
public func styleSpacing(for otherStandardStyle: OtherStandardStyle) -> (otherStandardStyle: OtherStandardStyle, topSpacing: CGFloat, bottomSpacing: CGFloat) {
|
||||
//set default return other style what you pass in
|
||||
var realOtherStyle = otherStandardStyle
|
||||
|
||||
//flatten all of the other styles registered for the title styles
|
||||
let allOtherStyles = spacingConfigurations.flatMap {$0.otherStandardStyles}
|
||||
|
||||
//get the default other style incase what is passed isn't within the registered collection
|
||||
if let first = allOtherStyles.first, !realOtherStyle.isWithin(allOtherStyles) {
|
||||
realOtherStyle = first
|
||||
}
|
||||
//get the config against the other style or return defaults
|
||||
guard let styleSpacing = spacingConfigurations.first(where: {realOtherStyle.isWithin($0.otherStandardStyles)}) else {
|
||||
return (realOtherStyle, VDSLayout.Spacing.space2X.value, VDSLayout.Spacing.space2X.value)
|
||||
}
|
||||
return (realOtherStyle, styleSpacing.topSpacing, styleSpacing.bottomSpacing)
|
||||
}
|
||||
}
|
||||
|
||||
public struct SpacingConfiguration {
|
||||
public var otherStandardStyles: [OtherStandardStyle]
|
||||
public var topSpacing: CGFloat
|
||||
public var bottomSpacing: CGFloat
|
||||
|
||||
public init(otherStandardStyles: [OtherStandardStyle], topSpacing: CGFloat, bottomSpacing: CGFloat) {
|
||||
self.otherStandardStyles = otherStandardStyles
|
||||
self.topSpacing = topSpacing
|
||||
self.bottomSpacing = bottomSpacing
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user