From 4ece9616a89dd7006550fd5c14559afd83f06820 Mon Sep 17 00:00:00 2001 From: schrockblock Date: Wed, 1 Jun 2022 16:34:54 -0400 Subject: [PATCH] add inits to styles --- Example/Pods/Pods.xcodeproj/project.pbxproj | 4 -- .../Core/FUICollectionViewDelegate.swift | 34 +++++++++++++++ .../Base/Models/CodableButtonStyle.swift | 38 ++++++++++++++++- .../Base/Models/CodableLabelStyle.swift | 42 ++++++++++++++++++- .../Base/Models/CodableTextFieldStyle.swift | 38 ++++++++++++++++- .../Base/Models/CodableTextViewStyle.swift | 40 +++++++++++++++++- .../Base/Models/CodableViewStyle.swift | 32 +++++++++++++- 7 files changed, 218 insertions(+), 10 deletions(-) create mode 100644 Example/Pods/fuikit/fuikit/Classes/Core/FUICollectionViewDelegate.swift diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index 318cf0e..067c4ef 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -65,7 +65,6 @@ 7EADBA346095D3CFAB78030009E1251C /* FCBPeripheralManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E76DEED194599D576F5BBCC745438469 /* FCBPeripheralManager.swift */; }; 8226B0EE367E4ED3F8A0407CDEED37CC /* CodableFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AAF60867C40609E1888B62A3FE21554 /* CodableFont.swift */; }; 84EDCCFF103BDDC06F6290E8D8CAEEFF /* FPUITableViewDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC2B24965ABEED9C29E6B84EFC2DF0F2 /* FPUITableViewDataSource.swift */; }; - 86EAB6DDF09E24DFB9F69330FB8ADBAF /* UrlOpening.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0D8156505F490D66FBFED0834D7238B /* UrlOpening.swift */; }; 86F914B3247753E1247EE11C5FE24933 /* Stubbable.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF9636F27F6151F4AA24391BBAA3FD33 /* Stubbable.swift */; }; 8CFC60B6E61C3BC7A52BF8C18329A342 /* FCLLocationManagerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCC01C60372AC901ABFA29D1B8820735 /* FCLLocationManagerDelegate.swift */; }; 91ED025BE7DE35C64313D8C081321D5F /* AccessoryViewConfigurable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F83F1A4FB71636A594F932035568044C /* AccessoryViewConfigurable.swift */; }; @@ -373,7 +372,6 @@ D83E2A27E2F13B75D3D825C575D07179 /* CodableButtonStyle.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = CodableButtonStyle.swift; sourceTree = ""; }; D9F6C6CAD3C75772E429133567ED34F9 /* Pods-LithoUtils_Tests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-LithoUtils_Tests.modulemap"; sourceTree = ""; }; E0B189AF4C8715F9C48BDBD9309FB9AB /* Tuples.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Tuples.swift; path = Sources/LithoOperators/Classes/Tuples.swift; sourceTree = ""; }; - E0D8156505F490D66FBFED0834D7238B /* UrlOpening.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = UrlOpening.swift; sourceTree = ""; }; E206D0F61EAF77F456EF81F276BF15E5 /* CodableLabelStyle.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = CodableLabelStyle.swift; sourceTree = ""; }; E2CD7C5EC3510FF63F1E93314C28FE94 /* FunNet-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "FunNet-prefix.pch"; sourceTree = ""; }; E3B9409315D429E5C6A5D49F281A2114 /* Slippers-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Slippers-prefix.pch"; sourceTree = ""; }; @@ -519,7 +517,6 @@ isa = PBXGroup; children = ( 6BDE82384763EE4136AB84DF13290575 /* iOSFunctions.swift */, - E0D8156505F490D66FBFED0834D7238B /* UrlOpening.swift */, 2B7F03F597868BD6DEE421DABAF41954 /* Styles.swift */, ); path = Functions; @@ -1427,7 +1424,6 @@ B52FD61C1EDA38842EE6613F08D478B3 /* Configurable.swift in Sources */, 98692A3206C6DB6C2CBAE76CCDF1DB75 /* iOSFunctions.swift in Sources */, 319EB0A06F8BAA59C6CBA22D089B27E5 /* LithoUtils-dummy.m in Sources */, - 86EAB6DDF09E24DFB9F69330FB8ADBAF /* UrlOpening.swift in Sources */, DFAA6D1EBF54E14BA78CB99103CF6AA4 /* Styles.swift in Sources */, F8C1D24A0F4A067EB4B37FA07F2CA21A /* UIColor+hex.swift in Sources */, FB26BADB327E4D93330EA9F7E3BCAF90 /* UIImage+Insets.swift in Sources */, diff --git a/Example/Pods/fuikit/fuikit/Classes/Core/FUICollectionViewDelegate.swift b/Example/Pods/fuikit/fuikit/Classes/Core/FUICollectionViewDelegate.swift new file mode 100644 index 0000000..53e7b62 --- /dev/null +++ b/Example/Pods/fuikit/fuikit/Classes/Core/FUICollectionViewDelegate.swift @@ -0,0 +1,34 @@ +// +// FUICollectionViewDelegate.swift +// fuikit +// +// Created by Elliot Schrock on 6/18/21. +// + +import Foundation + +open class FUICollectionViewDelegate: NSObject, UICollectionViewDelegate { + public var onDidHighlightItemAt: ((UICollectionView, IndexPath) -> Void)? + public var onDidUnhighlightItemAt: ((UICollectionView, IndexPath) -> Void)? + public var onDidSelectItemAt: ((UICollectionView, IndexPath) -> Void)? + public var onDidDeselectItemAt: ((UICollectionView, IndexPath) -> Void)? + public var onWillDisplayItemAt: ((UICollectionView, UICollectionViewCell, IndexPath) -> Void)? + public var onWillDisplaySupplementaryView: ((UICollectionView, UICollectionReusableView, String, IndexPath) -> Void)? + public var onDidEndDisplayingCellForItemAt: ((UICollectionView, UICollectionViewCell, IndexPath) -> Void)? + public var onDidEndDisplayingSupplementaryView: ((UICollectionView, UICollectionReusableView, String, IndexPath) -> Void)? + public var onDidUpdateFocusIn: ((UICollectionView, UICollectionViewFocusUpdateContext, UIFocusAnimationCoordinator) -> Void)? + + public func collectionView(_ collectionView: UICollectionView, didHighlightItemAt indexPath: IndexPath) { onDidHighlightItemAt?(collectionView, indexPath) } + public func collectionView(_ collectionView: UICollectionView, didUnhighlightItemAt indexPath: IndexPath) { onDidUnhighlightItemAt?(collectionView, indexPath) } + public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { onDidSelectItemAt?(collectionView, indexPath) } + public func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) { onDidDeselectItemAt?(collectionView, indexPath) } + public func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { onWillDisplayItemAt?(collectionView, cell, indexPath) } + public func collectionView(_ collectionView: UICollectionView, willDisplaySupplementaryView view: UICollectionReusableView, forElementKind elementKind: String, at indexPath: IndexPath) { + onWillDisplaySupplementaryView?(collectionView, view, elementKind, indexPath) + } + public func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { onDidEndDisplayingCellForItemAt?(collectionView, cell, indexPath) } + public func collectionView(_ collectionView: UICollectionView, didEndDisplayingSupplementaryView view: UICollectionReusableView, forElementOfKind elementKind: String, at indexPath: IndexPath) { + onDidEndDisplayingSupplementaryView?(collectionView, view, elementKind, indexPath) + } + public func collectionView(_ collectionView: UICollectionView, didUpdateFocusIn context: UICollectionViewFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) { onDidUpdateFocusIn?(collectionView, context, coordinator) } +} diff --git a/LithoUtils/Classes/Base/Models/CodableButtonStyle.swift b/LithoUtils/Classes/Base/Models/CodableButtonStyle.swift index bc705d2..fea70c4 100644 --- a/LithoUtils/Classes/Base/Models/CodableButtonStyle.swift +++ b/LithoUtils/Classes/Base/Models/CodableButtonStyle.swift @@ -31,7 +31,43 @@ open class CodableButtonStyle: CodableViewStyleProtocol, Codable { open var titleShadowColor: String? open var font: CodableFont? - public init() {} + public init( + backgroundColorHex: String? = nil, + tintColorHex: String? = nil, + isHidden: Bool? = nil, + isOpaque: Bool? = nil, + clipsToBounds: Bool? = nil, + alpha: CGFloat? = nil, + cornerRadius: CGFloat? = nil, + maskedCorners: CACornerMask? = nil, + isRounded: Bool? = nil, + borderWidth: CGFloat? = nil, + borderColorHex: String? = nil, + shadowColorHex: String? = nil, + shadowRadius: CGFloat? = nil, + shadowOpacity: Float? = nil, + font: CodableFont? = nil, + titleColor: String? = nil, + titleShadowColor: String? = nil + ) { + self.backgroundColorHex = backgroundColorHex + self.tintColorHex = tintColorHex + self.isHidden = isHidden + self.isOpaque = isOpaque + self.clipsToBounds = clipsToBounds + self.alpha = alpha + self.cornerRadius = cornerRadius + self.maskedCorners = maskedCorners + self.isRounded = isRounded + self.borderWidth = borderWidth + self.borderColorHex = borderColorHex + self.shadowColorHex = shadowColorHex + self.shadowRadius = shadowRadius + self.shadowOpacity = shadowOpacity + self.font = font + self.titleColor = titleColor + self.titleShadowColor = titleShadowColor + } public func apply(to view: UIView?) { view |> ~>styleButtonFunction(given: self) diff --git a/LithoUtils/Classes/Base/Models/CodableLabelStyle.swift b/LithoUtils/Classes/Base/Models/CodableLabelStyle.swift index be5cd2f..f802fb0 100644 --- a/LithoUtils/Classes/Base/Models/CodableLabelStyle.swift +++ b/LithoUtils/Classes/Base/Models/CodableLabelStyle.swift @@ -25,13 +25,51 @@ open class CodableLabelStyle: CodableViewStyleProtocol, Codable { public var shadowColorHex: String? public var shadowRadius: CGFloat? public var shadowOpacity: Float? - public var lineHeightMultiplier: CGFloat? public var font: CodableFont? public var textColor: String? public var labelShadowColor: String? + public var lineHeightMultiplier: CGFloat? - public init() {} + public init( + backgroundColorHex: String? = nil, + tintColorHex: String? = nil, + isHidden: Bool? = nil, + isOpaque: Bool? = nil, + clipsToBounds: Bool? = nil, + alpha: CGFloat? = nil, + cornerRadius: CGFloat? = nil, + maskedCorners: CACornerMask? = nil, + isRounded: Bool? = nil, + borderWidth: CGFloat? = nil, + borderColorHex: String? = nil, + shadowColorHex: String? = nil, + shadowRadius: CGFloat? = nil, + shadowOpacity: Float? = nil, + font: CodableFont? = nil, + textColor: String? = nil, + lineHeightMultiplier: CGFloat? = nil, + labelShadowColor: String? = nil + ) { + self.backgroundColorHex = backgroundColorHex + self.tintColorHex = tintColorHex + self.isHidden = isHidden + self.isOpaque = isOpaque + self.clipsToBounds = clipsToBounds + self.alpha = alpha + self.cornerRadius = cornerRadius + self.maskedCorners = maskedCorners + self.isRounded = isRounded + self.borderWidth = borderWidth + self.borderColorHex = borderColorHex + self.shadowColorHex = shadowColorHex + self.shadowRadius = shadowRadius + self.shadowOpacity = shadowOpacity + self.font = font + self.textColor = textColor + self.labelShadowColor = labelShadowColor + self.lineHeightMultiplier = lineHeightMultiplier + } public func apply(to view: UIView?) { view |> ~>styleLabelFunction(given: self) diff --git a/LithoUtils/Classes/Base/Models/CodableTextFieldStyle.swift b/LithoUtils/Classes/Base/Models/CodableTextFieldStyle.swift index 6340043..64f23bf 100644 --- a/LithoUtils/Classes/Base/Models/CodableTextFieldStyle.swift +++ b/LithoUtils/Classes/Base/Models/CodableTextFieldStyle.swift @@ -30,7 +30,43 @@ open class CodableTextFieldStyle: CodableViewStyleProtocol, Codable { public var textColor: String? public var borderStyle: UITextField.BorderStyle? - public init() {} + public init( + backgroundColorHex: String? = nil, + tintColorHex: String? = nil, + isHidden: Bool? = nil, + isOpaque: Bool? = nil, + clipsToBounds: Bool? = nil, + alpha: CGFloat? = nil, + cornerRadius: CGFloat? = nil, + maskedCorners: CACornerMask? = nil, + isRounded: Bool? = nil, + borderWidth: CGFloat? = nil, + borderColorHex: String? = nil, + shadowColorHex: String? = nil, + shadowRadius: CGFloat? = nil, + shadowOpacity: Float? = nil, + font: CodableFont? = nil, + textColor: String? = nil, + borderStyle: UITextField.BorderStyle? = nil + ) { + self.backgroundColorHex = backgroundColorHex + self.tintColorHex = tintColorHex + self.isHidden = isHidden + self.isOpaque = isOpaque + self.clipsToBounds = clipsToBounds + self.alpha = alpha + self.cornerRadius = cornerRadius + self.maskedCorners = maskedCorners + self.isRounded = isRounded + self.borderWidth = borderWidth + self.borderColorHex = borderColorHex + self.shadowColorHex = shadowColorHex + self.shadowRadius = shadowRadius + self.shadowOpacity = shadowOpacity + self.font = font + self.textColor = textColor + self.borderStyle = borderStyle + } public func apply(to view: UIView?) { view |> ~>styleTextFieldFunction(given: self) diff --git a/LithoUtils/Classes/Base/Models/CodableTextViewStyle.swift b/LithoUtils/Classes/Base/Models/CodableTextViewStyle.swift index a6af160..ebf7252 100644 --- a/LithoUtils/Classes/Base/Models/CodableTextViewStyle.swift +++ b/LithoUtils/Classes/Base/Models/CodableTextViewStyle.swift @@ -31,7 +31,45 @@ open class CodableTextViewStyle: CodableViewStyleProtocol, Codable { public var lineHeightMultiplier: CGFloat? public var lineFragmentPadding: CGFloat? - public init() {} + public init( + backgroundColorHex: String? = nil, + tintColorHex: String? = nil, + isHidden: Bool? = nil, + isOpaque: Bool? = nil, + clipsToBounds: Bool? = nil, + alpha: CGFloat? = nil, + cornerRadius: CGFloat? = nil, + maskedCorners: CACornerMask? = nil, + isRounded: Bool? = nil, + borderWidth: CGFloat? = nil, + borderColorHex: String? = nil, + shadowColorHex: String? = nil, + shadowRadius: CGFloat? = nil, + shadowOpacity: Float? = nil, + font: CodableFont? = nil, + textColor: String? = nil, + lineHeightMultiplier: CGFloat? = nil, + lineFragmentPadding: CGFloat? = nil + ) { + self.backgroundColorHex = backgroundColorHex + self.tintColorHex = tintColorHex + self.isHidden = isHidden + self.isOpaque = isOpaque + self.clipsToBounds = clipsToBounds + self.alpha = alpha + self.cornerRadius = cornerRadius + self.maskedCorners = maskedCorners + self.isRounded = isRounded + self.borderWidth = borderWidth + self.borderColorHex = borderColorHex + self.shadowColorHex = shadowColorHex + self.shadowRadius = shadowRadius + self.shadowOpacity = shadowOpacity + self.font = font + self.textColor = textColor + self.lineHeightMultiplier = lineHeightMultiplier + self.lineFragmentPadding = lineFragmentPadding + } public func apply(to view: UIView?) { view |> ~>styleTextViewFunction(given: self) diff --git a/LithoUtils/Classes/Base/Models/CodableViewStyle.swift b/LithoUtils/Classes/Base/Models/CodableViewStyle.swift index 74ad1bf..ad5e77e 100644 --- a/LithoUtils/Classes/Base/Models/CodableViewStyle.swift +++ b/LithoUtils/Classes/Base/Models/CodableViewStyle.swift @@ -54,7 +54,37 @@ open class CodableViewStyle: CodableViewStyleProtocol, Codable { open var shadowRadius: CGFloat? open var shadowOpacity: Float? - public init() {} + public init( + backgroundColorHex: String? = nil, + tintColorHex: String? = nil, + isHidden: Bool? = nil, + isOpaque: Bool? = nil, + clipsToBounds: Bool? = nil, + alpha: CGFloat? = nil, + cornerRadius: CGFloat? = nil, + maskedCorners: CACornerMask? = nil, + isRounded: Bool? = nil, + borderWidth: CGFloat? = nil, + borderColorHex: String? = nil, + shadowColorHex: String? = nil, + shadowRadius: CGFloat? = nil, + shadowOpacity: Float? = nil + ) { + self.backgroundColorHex = backgroundColorHex + self.tintColorHex = tintColorHex + self.isHidden = isHidden + self.isOpaque = isOpaque + self.clipsToBounds = clipsToBounds + self.alpha = alpha + self.cornerRadius = cornerRadius + self.maskedCorners = maskedCorners + self.isRounded = isRounded + self.borderWidth = borderWidth + self.borderColorHex = borderColorHex + self.shadowColorHex = shadowColorHex + self.shadowRadius = shadowRadius + self.shadowOpacity = shadowOpacity + } public func apply(to view: UIView?) { view |> styleFunction(given: self)