diff --git a/CHANGELOG.md b/CHANGELOG.md index 68782ada..93eb12ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +### 1.38.1 + +- **Added**: UIButton Appearance model +- **Added**: `SpacedWrappedViewLayout` for spacing configurations +- **Update**: UIView appearance model with border configurations + ### 1.38.0 - **Added**: Placemarks states for icon updating diff --git a/TIAppleMapUtils/TIAppleMapUtils.podspec b/TIAppleMapUtils/TIAppleMapUtils.podspec index 988c0113..0ccefe4e 100644 --- a/TIAppleMapUtils/TIAppleMapUtils.podspec +++ b/TIAppleMapUtils/TIAppleMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIAppleMapUtils' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Set of helpers for map objects clustering and interacting using Apple MapKit.' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIAuth/TIAuth.podspec b/TIAuth/TIAuth.podspec index d7d4f320..48145ef8 100644 --- a/TIAuth/TIAuth.podspec +++ b/TIAuth/TIAuth.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIAuth' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Login, registration, confirmation and other related actions' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIDeveloperUtils/TIDeveloperUtils.podspec b/TIDeveloperUtils/TIDeveloperUtils.podspec index b1a32994..268862e2 100644 --- a/TIDeveloperUtils/TIDeveloperUtils.podspec +++ b/TIDeveloperUtils/TIDeveloperUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIDeveloperUtils' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Universal web view API' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIEcommerce/TIEcommerce.podspec b/TIEcommerce/TIEcommerce.podspec index 179c410b..c703fc15 100644 --- a/TIEcommerce/TIEcommerce.podspec +++ b/TIEcommerce/TIEcommerce.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIEcommerce' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Cart, products, promocodes, bonuses and other related actions' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIFoundationUtils/TIFoundationUtils.podspec b/TIFoundationUtils/TIFoundationUtils.podspec index 418a3634..ceab48a2 100644 --- a/TIFoundationUtils/TIFoundationUtils.podspec +++ b/TIFoundationUtils/TIFoundationUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIFoundationUtils' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Set of helpers for Foundation framework classes.' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIGoogleMapUtils/TIGoogleMapUtils.podspec b/TIGoogleMapUtils/TIGoogleMapUtils.podspec index d98de8a1..afff0892 100644 --- a/TIGoogleMapUtils/TIGoogleMapUtils.podspec +++ b/TIGoogleMapUtils/TIGoogleMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIGoogleMapUtils' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Set of helpers for map objects clustering and interacting using Google Maps SDK.' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIKeychainUtils/TIKeychainUtils.podspec b/TIKeychainUtils/TIKeychainUtils.podspec index 384b1b05..9c8d53f3 100644 --- a/TIKeychainUtils/TIKeychainUtils.podspec +++ b/TIKeychainUtils/TIKeychainUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIKeychainUtils' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Set of helpers for Keychain classes.' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIMapUtils/TIMapUtils.podspec b/TIMapUtils/TIMapUtils.podspec index f469196c..ab545776 100644 --- a/TIMapUtils/TIMapUtils.podspec +++ b/TIMapUtils/TIMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIMapUtils' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Set of helpers for map objects clustering and interacting.' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIMoyaNetworking/TIMoyaNetworking.podspec b/TIMoyaNetworking/TIMoyaNetworking.podspec index 337d4b12..76c7a085 100644 --- a/TIMoyaNetworking/TIMoyaNetworking.podspec +++ b/TIMoyaNetworking/TIMoyaNetworking.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIMoyaNetworking' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Moya + Swagger network service.' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TINetworking/TINetworking.podspec b/TINetworking/TINetworking.podspec index f90c57fa..f8abe6eb 100644 --- a/TINetworking/TINetworking.podspec +++ b/TINetworking/TINetworking.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TINetworking' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Swagger-frendly networking layer helpers.' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TINetworkingCache/TINetworkingCache.podspec b/TINetworkingCache/TINetworkingCache.podspec index 6b6d58ad..7fbeea5f 100644 --- a/TINetworkingCache/TINetworkingCache.podspec +++ b/TINetworkingCache/TINetworkingCache.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TINetworkingCache' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Caching results of EndpointRequests.' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIPagination/TIPagination.podspec b/TIPagination/TIPagination.podspec index 4acb58c5..8a82d612 100644 --- a/TIPagination/TIPagination.podspec +++ b/TIPagination/TIPagination.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIPagination' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Generic pagination component.' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TISwiftUICore/TISwiftUICore.podspec b/TISwiftUICore/TISwiftUICore.podspec index bfd55bf8..e71acf42 100644 --- a/TISwiftUICore/TISwiftUICore.podspec +++ b/TISwiftUICore/TISwiftUICore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TISwiftUICore' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Core UI elements: protocols, views and helpers.' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TISwiftUtils/TISwiftUtils.podspec b/TISwiftUtils/TISwiftUtils.podspec index db38099d..6f6674eb 100644 --- a/TISwiftUtils/TISwiftUtils.podspec +++ b/TISwiftUtils/TISwiftUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TISwiftUtils' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Bunch of useful helpers for Swift development.' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TITableKitUtils/TITableKitUtils.podspec b/TITableKitUtils/TITableKitUtils.podspec index fb2348f6..20842e42 100644 --- a/TITableKitUtils/TITableKitUtils.podspec +++ b/TITableKitUtils/TITableKitUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TITableKitUtils' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Set of helpers for TableKit classes.' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIUIElements/Sources/Appearance/UIButton+Appearance.swift b/TIUIElements/Sources/Appearance/UIButton+Appearance.swift new file mode 100644 index 00000000..48b270cc --- /dev/null +++ b/TIUIElements/Sources/Appearance/UIButton+Appearance.swift @@ -0,0 +1,64 @@ +// +// Copyright (c) 2023 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import TIUIKitCore +import UIKit + +extension UIButton { + open class BaseAppearance: UILabel.BaseAppearance { + + public var contentInsets: UIEdgeInsets + public var titleInsets: UIEdgeInsets + public var imageInsets: UIEdgeInsets + + public init(layout: Layout = .defaultLayout, + backgroundColor: UIColor = .clear, + roundedCorners: CACornerMask = [], + cornerRadius: CGFloat = .zero, + borderColor: UIColor = .clear, + borderWidth: CGFloat = .zero, + shadow: UIViewShadow? = nil, + textAttributes: BaseTextAttributes? = nil, + contentInsets: UIEdgeInsets = .zero, + titleInsets: UIEdgeInsets = .zero, + imageInsets: UIEdgeInsets = .zero) { + + self.contentInsets = contentInsets + self.titleInsets = titleInsets + self.imageInsets = imageInsets + + super.init(layout: layout, + backgroundColor: backgroundColor, + roundedCorners: roundedCorners, + cornerRadius: cornerRadius, + borderColor: borderColor, + borderWidth: borderWidth, + shadow: shadow) + } + } + + public final class DefaultAppearance: BaseAppearance, WrappedViewAppearance { + public static var defaultAppearance: Self { + Self() + } + } +} diff --git a/TIUIElements/Sources/Appearance/UIButton+AppearanceConfigurable.swift b/TIUIElements/Sources/Appearance/UIButton+AppearanceConfigurable.swift index 6f0220e0..667bf059 100644 --- a/TIUIElements/Sources/Appearance/UIButton+AppearanceConfigurable.swift +++ b/TIUIElements/Sources/Appearance/UIButton+AppearanceConfigurable.swift @@ -24,11 +24,30 @@ import TIUIKitCore import UIKit extension UIButton { - public func configureUIButton(appearance: UILabel.BaseAppearance) { + public func configureUIButton(appearance: UIButton.BaseAppearance) { appearance.textAttributes? .configure(button: self, with: titleLabel?.attributedText?.string ?? titleLabel?.text) + if #available(iOS 15, *) { + configuration?.contentInsets = .init(insets: appearance.contentInsets) + + if configuration?.imagePlacement == .leading { + let padding = appearance.titleInsets.left + appearance.imageInsets.right + configuration?.imagePadding = padding + } + + if configuration?.imagePlacement == .trailing { + let padding = appearance.titleInsets.right + appearance.imageInsets.left + configuration?.imagePadding = padding + } + + } else { + contentEdgeInsets = appearance.contentInsets + titleEdgeInsets = appearance.titleInsets + imageEdgeInsets = appearance.imageInsets + } + super.configureUIView(appearance: appearance) } } diff --git a/TIUIElements/Sources/Appearance/UILabel+Appearance.swift b/TIUIElements/Sources/Appearance/UILabel+Appearance.swift index 99f26ce4..ab0ab1a5 100644 --- a/TIUIElements/Sources/Appearance/UILabel+Appearance.swift +++ b/TIUIElements/Sources/Appearance/UILabel+Appearance.swift @@ -32,6 +32,8 @@ extension UILabel { backgroundColor: UIColor = .clear, roundedCorners: CACornerMask = [], cornerRadius: CGFloat = .zero, + borderColor: UIColor = .clear, + borderWidth: CGFloat = .zero, shadow: UIViewShadow? = nil, textAttributes: BaseTextAttributes? = nil) { @@ -41,6 +43,8 @@ extension UILabel { backgroundColor: backgroundColor, roundedCorners: roundedCorners, cornerRadius: cornerRadius, + borderColor: borderColor, + borderWidth: borderWidth, shadow: shadow) } } diff --git a/TIUIElements/Sources/Appearance/UIVIew+AppearanceConfigurable.swift b/TIUIElements/Sources/Appearance/UIVIew+AppearanceConfigurable.swift index 624ca942..ad96907c 100644 --- a/TIUIElements/Sources/Appearance/UIVIew+AppearanceConfigurable.swift +++ b/TIUIElements/Sources/Appearance/UIVIew+AppearanceConfigurable.swift @@ -29,6 +29,8 @@ extension UIView { layer.masksToBounds = true layer.maskedCorners = appearance.roundedCorners layer.cornerRadius = appearance.cornerRadius + layer.borderWidth = appearance.borderWidth + layer.borderColor = appearance.borderColor.cgColor guard let shadow = appearance.shadow else { return diff --git a/TIUIElements/Sources/Appearance/UIView+Appearance.swift b/TIUIElements/Sources/Appearance/UIView+Appearance.swift index ceaa0d1b..63835de0 100644 --- a/TIUIElements/Sources/Appearance/UIView+Appearance.swift +++ b/TIUIElements/Sources/Appearance/UIView+Appearance.swift @@ -64,12 +64,31 @@ extension UIView { } } + open class BaseSpecedWrappedLayout: BaseWrappedLayout { + public var spacing: CGFloat + + public init(insets: UIEdgeInsets = .zero, + size: CGSize = .infinity, + centerOffset: UIOffset = .nan, + spacing: CGFloat = .zero) { + self.spacing = spacing + + super.init(insets: insets, size: size, centerOffset: centerOffset) + } + } + public final class DefaultWrappedLayout: BaseWrappedLayout, WrappedViewLayout { public static var defaultLayout: Self { Self() } } + public final class DefaultSpacedWrappedLayout: BaseSpecedWrappedLayout, SpacedWrappedViewLayout { + public static var defaultLayout: Self { + Self() + } + } + // MARK: - Appearance Variations open class BaseAppearance { @@ -78,18 +97,24 @@ extension UIView { public var backgroundColor: UIColor public var roundedCorners: CACornerMask public var cornerRadius: CGFloat + public var borderColor: UIColor + public var borderWidth: CGFloat public var shadow: UIViewShadow? public init(layout: Layout = .defaultLayout, backgroundColor: UIColor = .clear, roundedCorners: CACornerMask = [], cornerRadius: CGFloat = .zero, + borderColor: UIColor = .clear, + borderWidth: CGFloat = .zero, shadow: UIViewShadow? = nil) { self.layout = layout self.backgroundColor = backgroundColor self.roundedCorners = roundedCorners self.cornerRadius = cornerRadius + self.borderColor = borderColor + self.borderWidth = borderWidth self.shadow = shadow } } @@ -137,6 +162,12 @@ extension UIView { Self() } } + + public final class DefaultSpacedWrappedAppearance: BaseAppearance, WrappedViewAppearance { + public static var defaultAppearance: Self { + Self() + } + } } extension UIView.DefaultWrappedViewHolderAppearance: WrappedViewAppearance where Layout: WrappedViewLayout { diff --git a/TIUIElements/Sources/Views/ListItemView/BaseListItemView.swift b/TIUIElements/Sources/Views/ListItemView/BaseListItemView.swift index d273e73c..4d2003b3 100644 --- a/TIUIElements/Sources/Views/ListItemView/BaseListItemView.swift +++ b/TIUIElements/Sources/Views/ListItemView/BaseListItemView.swift @@ -199,14 +199,12 @@ open class BaseListItemView + public typealias Appearance = UIButton.BaseAppearance public typealias StateAppearance = [State: Appearance] public typealias StateEventPropagations = [State: Bool] diff --git a/TIUIElements/Sources/Views/TitleSubtitleView/DefaultTitleSubtitleView+Appearance.swift b/TIUIElements/Sources/Views/TitleSubtitleView/DefaultTitleSubtitleView+Appearance.swift index 073164c4..a66ce6be 100644 --- a/TIUIElements/Sources/Views/TitleSubtitleView/DefaultTitleSubtitleView+Appearance.swift +++ b/TIUIElements/Sources/Views/TitleSubtitleView/DefaultTitleSubtitleView+Appearance.swift @@ -24,25 +24,8 @@ import TIUIKitCore import UIKit extension DefaultTitleSubtitleView { - public final class Layout: UIView.BaseWrappedLayout, WrappedViewLayout { - public static var defaultLayout: Layout { - Self() - } - - public var spacing: CGFloat - - public init(insets: UIEdgeInsets = .zero, - centerOffset: UIOffset = .zero, - spacing: CGFloat = .zero) { - - self.spacing = spacing - - super.init(insets: insets, centerOffset: centerOffset) - } - } - - public final class Appearance: UIView.BaseAppearance, WrappedViewAppearance { + public final class Appearance: UIView.BaseAppearance, WrappedViewAppearance { public static var defaultAppearance: Appearance { Self() @@ -55,6 +38,8 @@ extension DefaultTitleSubtitleView { backgroundColor: UIColor = .clear, roundedCorners: CACornerMask = [], cornerRadius: CGFloat = .zero, + borderColor: UIColor = .clear, + borderWidth: CGFloat = .zero, shadow: UIViewShadow? = nil, titleAppearance: UILabel.DefaultAppearance = .defaultAppearance, subtitleAppearance: UILabel.DefaultAppearance = .defaultAppearance) { @@ -66,6 +51,8 @@ extension DefaultTitleSubtitleView { backgroundColor: backgroundColor, roundedCorners: roundedCorners, cornerRadius: cornerRadius, + borderColor: borderColor, + borderWidth: borderWidth, shadow: shadow) } } diff --git a/TIUIElements/Sources/Views/TitleSubtitleView/DefaultTitleSubtitleView.swift b/TIUIElements/Sources/Views/TitleSubtitleView/DefaultTitleSubtitleView.swift index 01f0c9c5..4dc0c7e4 100644 --- a/TIUIElements/Sources/Views/TitleSubtitleView/DefaultTitleSubtitleView.swift +++ b/TIUIElements/Sources/Views/TitleSubtitleView/DefaultTitleSubtitleView.swift @@ -89,7 +89,7 @@ public final class DefaultTitleSubtitleView: BaseInitializableView, configure(layout: appearance.layout) } - public func configure(layout: Layout) { + public func configure(layout: UIView.DefaultSpacedWrappedLayout) { spacingConstraint?.constant = layout.spacing } } diff --git a/TIUIElements/TIUIElements.podspec b/TIUIElements/TIUIElements.podspec index 65be4ab4..c05e4f86 100644 --- a/TIUIElements/TIUIElements.podspec +++ b/TIUIElements/TIUIElements.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIUIElements' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Bunch of useful protocols and views.' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIUIKitCore/Sources/Appearance/Helpers/WrappedViewLayout+Helpers.swift b/TIUIKitCore/Sources/Appearance/Helpers/WrappedViewLayout+Helpers.swift new file mode 100644 index 00000000..e63b5e7b --- /dev/null +++ b/TIUIKitCore/Sources/Appearance/Helpers/WrappedViewLayout+Helpers.swift @@ -0,0 +1,85 @@ +// +// Copyright (c) 2023 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import UIKit + +public extension WrappedViewLayout { + func setupSize(widthConstraint: NSLayoutConstraint?, + heightConstraint: NSLayoutConstraint?) { + + if size.width.isFinite { + widthConstraint?.constant = size.width + widthConstraint?.isActive = true + } else { + widthConstraint?.isActive = false + } + + if size.height.isFinite { + heightConstraint?.constant = size.height + heightConstraint?.isActive = true + } else { + heightConstraint?.isActive = false + } + } + + func setupCenterYOffset(centerYConstraint: NSLayoutConstraint?, + topConstraint: NSLayoutConstraint?, + bottomConstraint: NSLayoutConstraint?) { + + let centerYOffset = centerOffset.vertical + + if centerYOffset.isFinite { + centerYConstraint?.constant = centerYOffset + centerYConstraint?.isActive = true + topConstraint?.isActive = false + bottomConstraint?.isActive = false + + } else { + topConstraint?.constant = insets.top + bottomConstraint?.constant = -insets.bottom + centerYConstraint?.isActive = false + topConstraint?.isActive = true + bottomConstraint?.isActive = true + } + } + + func setupCenterXOffset(centerXConstraint: NSLayoutConstraint?, + leadingConstraint: NSLayoutConstraint?, + trailingConstraint: NSLayoutConstraint?) { + + let centerXOffset = centerOffset.horizontal + + if centerXOffset.isFinite { + centerXConstraint?.constant = centerXOffset + centerXConstraint?.isActive = true + leadingConstraint?.isActive = false + trailingConstraint?.isActive = false + + } else { + leadingConstraint?.constant = insets.left + trailingConstraint?.constant = -insets.right + centerXConstraint?.isActive = false + leadingConstraint?.isActive = true + trailingConstraint?.isActive = true + } + } +} diff --git a/TIUIKitCore/Sources/Appearance/ViewAppearance.swift b/TIUIKitCore/Sources/Appearance/ViewAppearance.swift index 5c54f44d..44f71745 100644 --- a/TIUIKitCore/Sources/Appearance/ViewAppearance.swift +++ b/TIUIKitCore/Sources/Appearance/ViewAppearance.swift @@ -31,6 +31,8 @@ public protocol ViewAppearance { var backgroundColor: UIColor { get } var roundedCorners: CACornerMask { get } var cornerRadius: CGFloat { get } + var borderColor: UIColor { get } + var borderWidth: CGFloat { get } var shadow: UIViewShadow? { get } } diff --git a/TIUIKitCore/Sources/Appearance/ViewLayout.swift b/TIUIKitCore/Sources/Appearance/ViewLayout.swift index 82f89e0f..24c51307 100644 --- a/TIUIKitCore/Sources/Appearance/ViewLayout.swift +++ b/TIUIKitCore/Sources/Appearance/ViewLayout.swift @@ -38,6 +38,10 @@ public protocol WrappedViewLayout: SizeViewLayout { var centerOffset: UIOffset { get } } +public protocol SpacedWrappedViewLayout: WrappedViewLayout { + var spacing: CGFloat { get } +} + // MARK: - Creation methods extension ViewLayout { diff --git a/TIUIKitCore/Sources/TextAttributes/BaseTextAttributes/BaseTextAttributes.swift b/TIUIKitCore/Sources/TextAttributes/BaseTextAttributes/BaseTextAttributes.swift index bc589798..719578fb 100644 --- a/TIUIKitCore/Sources/TextAttributes/BaseTextAttributes/BaseTextAttributes.swift +++ b/TIUIKitCore/Sources/TextAttributes/BaseTextAttributes/BaseTextAttributes.swift @@ -154,7 +154,7 @@ open class BaseTextAttributes { open func configure(button: UIButton, with string: String? = nil) { if #available(iOS 15, *) { - var configuration = UIButton.Configuration.plain() + var configuration = button.configuration ?? UIButton.Configuration.plain() if let title = string { button.setTitle(nil, for: .normal) diff --git a/TIUIKitCore/TIUIKitCore.podspec b/TIUIKitCore/TIUIKitCore.podspec index 7c281128..444b8842 100644 --- a/TIUIKitCore/TIUIKitCore.podspec +++ b/TIUIKitCore/TIUIKitCore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIUIKitCore' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Core UI elements: protocols, views and helpers.' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIWebView/TIWebView.podspec b/TIWebView/TIWebView.podspec index 5e74ef4c..86d5a948 100644 --- a/TIWebView/TIWebView.podspec +++ b/TIWebView/TIWebView.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIWebView' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Universal web view API' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIYandexMapUtils/TIYandexMapUtils.podspec b/TIYandexMapUtils/TIYandexMapUtils.podspec index b90fd31f..e9b55fc7 100644 --- a/TIYandexMapUtils/TIYandexMapUtils.podspec +++ b/TIYandexMapUtils/TIYandexMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIYandexMapUtils' - s.version = '1.38.0' + s.version = '1.38.1' s.summary = 'Set of helpers for map objects clustering and interacting using Yandex Maps SDK.' s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' }