feat: Added: BaseTitleSubtitleView which can be inherited for fine-tuning skeletons and other behavior. #20
|
|
@ -1,5 +1,11 @@
|
|||
# Changelog
|
||||
|
||||
### 1.54.1
|
||||
|
||||
- **Added**: `BaseTitleSubtitleView` which can be inherited for fine-tuning skeletons and other behavior.
|
||||
- **Update**: Changed lines number calculation method in `TextSkeletonsConfiguration`.
|
||||
|
||||
|
||||
### 1.54.0
|
||||
|
||||
- **Added**: `maxWidth` parameter to `BaseViewSkeletonsConfiguration`.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIAppleMapUtils'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Set of helpers for map objects clustering and interacting using Apple MapKit.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIApplication'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Application architecture.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIAuth'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Login, registration, confirmation and other related actions'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIBottomSheet'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Base models for creating bottom sheet view controllers'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TICoreGraphicsUtils'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'CoreGraphics drawing helpers'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIDeeplink'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Deeplink service API'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIDeveloperUtils'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Universal web view API'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIEcommerce'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Cart, products, promocodes, bonuses and other related actions'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIFoundationUtils'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Set of helpers for Foundation framework classes.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIGoogleMapUtils'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Set of helpers for map objects clustering and interacting using Google Maps SDK.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIKeychainUtils'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Set of helpers for Keychain classes.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TILogging'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Logging for TI libraries.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIMapUtils'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Set of helpers for map objects clustering and interacting.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIMoyaNetworking'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Moya + Swagger network service.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TINetworking'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Swagger-frendly networking layer helpers.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TINetworkingCache'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Caching results of EndpointRequests.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIPagination'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Generic pagination component.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TISwiftUICore'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Core UI elements: protocols, views and helpers.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TISwiftUtils'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Bunch of useful helpers for Swift development.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TITableKitUtils'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Set of helpers for TableKit classes.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TITextProcessing'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'A text processing service helping to get a text mask and a placeholder from incoming regex.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -44,12 +44,12 @@ open class TextSkeletonsConfiguration: BaseViewSkeletonsConfiguration {
|
|||
}
|
||||
}
|
||||
|
||||
public var numberOfLines: Int
|
||||
public var numberOfLines: Int?
|
||||
public var linesWidthFraction: [CGFloat]
|
||||
public var lineHeight: CGFloat?
|
||||
public var lineSpacing: CGFloat?
|
||||
|
||||
public init(numberOfLines: Int = Defaults.numberOfLines,
|
||||
public init(numberOfLines: Int? = nil,
|
||||
linesWidthFraction: [CGFloat] = Defaults.linesWidthFraction,
|
||||
lineHeight: CGFloat? = nil,
|
||||
lineSpacing: CGFloat? = nil,
|
||||
|
|
@ -68,7 +68,7 @@ open class TextSkeletonsConfiguration: BaseViewSkeletonsConfiguration {
|
|||
open func createConfiguration(for label: UILabel) -> TextSkeletonsConfiguration {
|
||||
let labelFont = getFont(from: label)
|
||||
|
||||
return copyWith(numberOfLines: label.numberOfLines,
|
||||
return copyWith(numberOfLines: getLinesCount(viewNumberOfLines: label.numberOfLines),
|
||||
lineHeight: calculateLineHeight(for: labelFont),
|
||||
lineSpacing: calculateLineSpacing(for: labelFont),
|
||||
padding: padding,
|
||||
|
|
@ -79,7 +79,7 @@ open class TextSkeletonsConfiguration: BaseViewSkeletonsConfiguration {
|
|||
open func createConfiguration(for textView: UITextView) -> TextSkeletonsConfiguration {
|
||||
let labelFont = getFont(from: textView)
|
||||
|
||||
return copyWith(numberOfLines: textView.textContainer.maximumNumberOfLines,
|
||||
return copyWith(numberOfLines: getLinesCount(viewNumberOfLines: textView.textContainer.maximumNumberOfLines),
|
||||
lineHeight: calculateLineHeight(for: labelFont),
|
||||
lineSpacing: calculateLineSpacing(for: labelFont),
|
||||
padding: padding,
|
||||
|
|
@ -108,7 +108,7 @@ open class TextSkeletonsConfiguration: BaseViewSkeletonsConfiguration {
|
|||
cornerRadius = radius / 2
|
||||
}
|
||||
|
||||
for lineNumber in 0..<numberOfLines {
|
||||
for lineNumber in 0..<(numberOfLines ?? Defaults.numberOfLines) {
|
||||
let adjustedLineRect: CGRect
|
||||
|
||||
if linesWidthFraction.isEmpty {
|
||||
|
|
@ -202,4 +202,14 @@ open class TextSkeletonsConfiguration: BaseViewSkeletonsConfiguration {
|
|||
maxWidth: maxWidth ?? self.maxWidth,
|
||||
shape: shape ?? self.shape)
|
||||
}
|
||||
|
||||
private func getLinesCount(viewNumberOfLines: Int) -> Int {
|
||||
if let numberOfLines {
|
||||
return numberOfLines
|
||||
} else {
|
||||
return viewNumberOfLines == 0
|
||||
? Defaults.multilineNumberOfLines
|
||||
: viewNumberOfLines
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,23 +23,20 @@
|
|||
import TIUIKitCore
|
||||
import UIKit
|
||||
|
||||
public extension DefaultTitleSubtitleView {
|
||||
extension BaseTitleSubtitleView {
|
||||
open class Appearance<TitleAppearance: WrappedViewAppearance,
|
||||
SubtitleAppearance: WrappedViewAppearance>:
|
||||
UIView.BaseAppearance<UIView.DefaultSpacedWrappedLayout> {
|
||||
|
||||
final class Appearance: UIView.BaseAppearance<UIView.DefaultSpacedWrappedLayout>, WrappedViewAppearance {
|
||||
public var titleAppearance: TitleAppearance
|
||||
public var subtitleAppearance: SubtitleAppearance
|
||||
|
||||
public static var defaultAppearance: Appearance {
|
||||
Self()
|
||||
}
|
||||
|
||||
public var titleAppearance: UILabel.DefaultAppearance
|
||||
public var subtitleAppearance: UILabel.DefaultAppearance
|
||||
|
||||
public init(layout: Layout = .defaultLayout,
|
||||
public init(layout: UIView.DefaultSpacedWrappedLayout = .defaultLayout,
|
||||
background: UIViewBackground = UIViewColorBackground(color: .clear),
|
||||
border: UIViewBorder = BaseUIViewBorder(),
|
||||
shadow: UIViewShadow? = nil,
|
||||
titleAppearance: UILabel.DefaultAppearance = .defaultAppearance,
|
||||
subtitleAppearance: UILabel.DefaultAppearance = .defaultAppearance) {
|
||||
titleAppearance: TitleAppearance = .defaultAppearance,
|
||||
subtitleAppearance: SubtitleAppearance = .defaultAppearance) {
|
||||
|
||||
self.titleAppearance = titleAppearance
|
||||
self.subtitleAppearance = subtitleAppearance
|
||||
|
|
@ -23,57 +23,60 @@
|
|||
import TIUIKitCore
|
||||
import UIKit
|
||||
|
||||
public final class DefaultTitleSubtitleView: BaseInitializableView,
|
||||
ConfigurableView,
|
||||
AppearanceConfigurable {
|
||||
open class BaseTitleSubtitleView<TitleView: UIView, SubtitleView: UIView>: BaseInitializableView {
|
||||
internal let titleView = TitleView()
|
||||
internal let subtitleView = SubtitleView()
|
||||
|
||||
private let titleLabel = UILabel()
|
||||
private let subtitleLabel = UILabel()
|
||||
|
||||
private var appearance: Appearance = .defaultAppearance
|
||||
|
||||
public private(set) lazy var titleBottomToSuperviewConstraint: NSLayoutConstraint = {
|
||||
titleLabel.bottomAnchor.constraint(equalTo: bottomAnchor)
|
||||
public internal(set) lazy var titleBottomToSuperviewConstraint: NSLayoutConstraint = {
|
||||
titleView.bottomAnchor.constraint(equalTo: bottomAnchor)
|
||||
}()
|
||||
|
||||
public private(set) lazy var titleBottomToSubtitleConstraint: NSLayoutConstraint = {
|
||||
titleLabel.bottomAnchor.constraint(equalTo: subtitleLabel.topAnchor)
|
||||
public internal(set) lazy var titleBottomToSubtitleConstraint: NSLayoutConstraint = {
|
||||
titleView.bottomAnchor.constraint(equalTo: subtitleView.topAnchor)
|
||||
}()
|
||||
|
||||
public private(set) lazy var titleConstraints: SubviewConstraints = {
|
||||
let edgeConstraints = EdgeConstraints(leadingConstraint: titleLabel.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
trailingConstraint: titleLabel.trailingAnchor.constraint(equalTo: trailingAnchor),
|
||||
topConstraint: titleLabel.topAnchor.constraint(equalTo: topAnchor),
|
||||
public internal(set) lazy var titleConstraints: SubviewConstraints = {
|
||||
let leadingConstraint = titleView.leadingAnchor.constraint(equalTo: leadingAnchor)
|
||||
let trailingConstraint = titleView.trailingAnchor.constraint(equalTo: trailingAnchor)
|
||||
let topConstraint = titleView.topAnchor.constraint(equalTo: topAnchor)
|
||||
|
||||
let edgeConstraints = EdgeConstraints(leadingConstraint: leadingConstraint,
|
||||
trailingConstraint: trailingConstraint,
|
||||
topConstraint: topConstraint,
|
||||
bottomConstraint: titleBottomToSubtitleConstraint)
|
||||
|
||||
let centerXConstraint = titleLabel.centerXAnchor.constraint(equalTo: centerXAnchor)
|
||||
let centerYConstraint = titleLabel.centerYAnchor.constraint(equalTo: centerYAnchor)
|
||||
let centerXConstraint = titleView.centerXAnchor.constraint(equalTo: centerXAnchor)
|
||||
let centerYConstraint = titleView.centerYAnchor.constraint(equalTo: centerYAnchor)
|
||||
|
||||
let centerConstraints = CenterConstraints(centerXConstraint: centerXConstraint,
|
||||
centerYConstraint: centerYConstraint)
|
||||
|
||||
let sizeConstraints = SizeConstraints(widthConstraint: titleLabel.widthAnchor.constraint(equalToConstant: .zero),
|
||||
heightConstraint: titleLabel.heightAnchor.constraint(equalToConstant: .zero))
|
||||
let sizeConstraints = SizeConstraints(widthConstraint: titleView.widthAnchor.constraint(equalToConstant: .zero),
|
||||
heightConstraint: titleView.heightAnchor.constraint(equalToConstant: .zero))
|
||||
|
||||
return SubviewConstraints(edgeConstraints: edgeConstraints,
|
||||
centerConstraints: centerConstraints,
|
||||
sizeConstraints: sizeConstraints)
|
||||
}()
|
||||
|
||||
public private(set) lazy var subtitleConstraints: SubviewConstraints = {
|
||||
let edgeConstraints = EdgeConstraints(leadingConstraint: subtitleLabel.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
trailingConstraint: subtitleLabel.trailingAnchor.constraint(equalTo: trailingAnchor),
|
||||
topConstraint: titleBottomToSubtitleConstraint,
|
||||
bottomConstraint: subtitleLabel.bottomAnchor.constraint(equalTo: bottomAnchor))
|
||||
public internal(set) lazy var subtitleConstraints: SubviewConstraints = {
|
||||
let leadingConstraint = subtitleView.leadingAnchor.constraint(equalTo: leadingAnchor)
|
||||
let trailingConstraint = subtitleView.trailingAnchor.constraint(equalTo: trailingAnchor)
|
||||
let bottomConstraint = subtitleView.bottomAnchor.constraint(equalTo: bottomAnchor)
|
||||
|
||||
let centerXConstraint = subtitleLabel.centerXAnchor.constraint(equalTo: centerXAnchor)
|
||||
let centerYConstraint = subtitleLabel.centerYAnchor.constraint(equalTo: centerYAnchor)
|
||||
let edgeConstraints = EdgeConstraints(leadingConstraint: leadingConstraint,
|
||||
trailingConstraint: trailingConstraint,
|
||||
topConstraint: titleBottomToSubtitleConstraint,
|
||||
bottomConstraint: bottomConstraint)
|
||||
|
||||
let centerXConstraint = subtitleView.centerXAnchor.constraint(equalTo: centerXAnchor)
|
||||
let centerYConstraint = subtitleView.centerYAnchor.constraint(equalTo: centerYAnchor)
|
||||
|
||||
let centerConstraints = CenterConstraints(centerXConstraint: centerXConstraint,
|
||||
centerYConstraint: centerYConstraint)
|
||||
|
||||
let sizeConstraints = SizeConstraints(widthConstraint: subtitleLabel.widthAnchor.constraint(equalToConstant: .zero),
|
||||
heightConstraint: subtitleLabel.heightAnchor.constraint(equalToConstant: .zero))
|
||||
let sizeConstraints = SizeConstraints(widthConstraint: subtitleView.widthAnchor.constraint(equalToConstant: .zero),
|
||||
heightConstraint: subtitleView.heightAnchor.constraint(equalToConstant: .zero))
|
||||
|
||||
return SubviewConstraints(edgeConstraints: edgeConstraints,
|
||||
centerConstraints: centerConstraints,
|
||||
|
|
@ -82,59 +85,40 @@ public final class DefaultTitleSubtitleView: BaseInitializableView,
|
|||
|
||||
// MARK: - InitializableViewProtocol
|
||||
|
||||
public override func addViews() {
|
||||
open override func addViews() {
|
||||
super.addViews()
|
||||
|
||||
addSubviews(titleLabel, subtitleLabel)
|
||||
addSubviews(titleView, subtitleView)
|
||||
}
|
||||
|
||||
public override func configureLayout() {
|
||||
open override func configureLayout() {
|
||||
super.configureLayout()
|
||||
|
||||
[titleLabel, subtitleLabel]
|
||||
[titleView, subtitleView]
|
||||
.forEach { $0.translatesAutoresizingMaskIntoConstraints = false }
|
||||
|
||||
configure(appearance: appearance)
|
||||
}
|
||||
|
||||
// MARK: - ConfigurableView
|
||||
|
||||
public func configure(with viewModel: DefaultTitleSubtitleViewModel) {
|
||||
titleLabel.text = viewModel.title
|
||||
titleLabel.configureUILabel(appearance: appearance.titleAppearance)
|
||||
|
||||
subtitleLabel.text = viewModel.subtitle
|
||||
subtitleLabel.configureUILabel(appearance: appearance.subtitleAppearance)
|
||||
|
||||
setSubtitle(hidden: viewModel.isSubtitleHidden)
|
||||
}
|
||||
|
||||
// MARK: - Public methods
|
||||
|
||||
public func setSubtitle(hidden: Bool) {
|
||||
guard subtitleLabel.isHidden != hidden else {
|
||||
open func setSubtitle(hidden: Bool) {
|
||||
guard subtitleView.isHidden != hidden else {
|
||||
return
|
||||
}
|
||||
|
||||
subtitleLabel.isHidden = hidden
|
||||
|
||||
configure(appearance: appearance)
|
||||
subtitleView.isHidden = hidden
|
||||
}
|
||||
|
||||
// MARK: - AppearanceConfigurable
|
||||
|
||||
public func configure(appearance: Appearance) {
|
||||
self.appearance = appearance
|
||||
open func configureBaseTitleSubtitle(appearance: Appearance<some WrappedViewAppearance,
|
||||
some WrappedViewAppearance>) {
|
||||
|
||||
configureUIView(appearance: appearance)
|
||||
|
||||
titleLabel.configureUILabel(appearance: appearance.titleAppearance)
|
||||
subtitleLabel.configureUILabel(appearance: appearance.subtitleAppearance)
|
||||
|
||||
configure(layout: appearance.layout,
|
||||
titleLayout: appearance.titleAppearance.layout,
|
||||
subtitleLayout: appearance.subtitleAppearance.layout,
|
||||
subtitleHidden: subtitleLabel.isHidden)
|
||||
subtitleHidden: subtitleView.isHidden)
|
||||
}
|
||||
|
||||
public func configure(layout: some SpacedWrappedViewLayout,
|
||||
|
|
@ -148,7 +132,7 @@ public final class DefaultTitleSubtitleView: BaseInitializableView,
|
|||
? titleBottomToSuperviewConstraint
|
||||
: titleBottomToSubtitleConstraint
|
||||
|
||||
titleConstraints.update(from: appearance.titleAppearance.layout)
|
||||
titleConstraints.update(from: titleLayout)
|
||||
|
||||
let spacing: CGFloat
|
||||
|
||||
|
|
@ -158,17 +142,18 @@ public final class DefaultTitleSubtitleView: BaseInitializableView,
|
|||
spacing = titleBottomInset.isFinite
|
||||
? layout.spacing + titleBottomInset
|
||||
: layout.spacing
|
||||
|
||||
subtitleConstraints.deactivate()
|
||||
} else {
|
||||
let verticalInsets = titleLayout.insets.add(\.bottom,
|
||||
to: \.top,
|
||||
of: subtitleLayout.insets)
|
||||
to: \.top,
|
||||
of: subtitleLayout.insets)
|
||||
|
||||
spacing = verticalInsets.isFinite
|
||||
? layout.spacing + verticalInsets
|
||||
: layout.spacing
|
||||
|
||||
subtitleConstraints.update(from: appearance.subtitleAppearance.layout)
|
||||
subtitleConstraints.update(from: subtitleLayout)
|
||||
}
|
||||
|
||||
titleBottomToSubtitleConstraint.constant = -spacing
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// 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
|
||||
|
||||
public extension DefaultTitleSubtitleView {
|
||||
final class Appearance: BaseTitleSubtitleView<UILabel, UILabel>
|
||||
.Appearance<UILabel.DefaultAppearance, UILabel.DefaultAppearance>,
|
||||
WrappedViewAppearance {
|
||||
|
||||
public static var defaultAppearance: Appearance {
|
||||
Self()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
//
|
||||
// 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
|
||||
|
||||
public final class DefaultTitleSubtitleView: BaseTitleSubtitleView<UILabel, UILabel>,
|
||||
ConfigurableView,
|
||||
AppearanceConfigurable {
|
||||
|
||||
private var appearance: Appearance = .defaultAppearance
|
||||
|
||||
// MARK: - InitializableViewProtocol
|
||||
|
||||
public override func configureLayout() {
|
||||
super.configureLayout()
|
||||
|
||||
configure(appearance: appearance)
|
||||
}
|
||||
|
||||
// MARK: - ConfigurableView
|
||||
|
||||
public func configure(with viewModel: DefaultTitleSubtitleViewModel) {
|
||||
titleView.text = viewModel.title
|
||||
titleView.configureUILabel(appearance: appearance.titleAppearance)
|
||||
|
||||
subtitleView.text = viewModel.subtitle
|
||||
subtitleView.configureUILabel(appearance: appearance.subtitleAppearance)
|
||||
|
||||
setSubtitle(hidden: viewModel.isSubtitleHidden)
|
||||
}
|
||||
|
||||
// MARK: - Public methods
|
||||
|
||||
public override func setSubtitle(hidden: Bool) {
|
||||
super.setSubtitle(hidden: hidden)
|
||||
|
||||
configure(appearance: appearance)
|
||||
}
|
||||
|
||||
// MARK: - AppearanceConfigurable
|
||||
|
||||
public func configure(appearance: Appearance) {
|
||||
self.appearance = appearance
|
||||
|
||||
configureBaseTitleSubtitle(appearance: appearance)
|
||||
|
||||
titleView.configureUILabel(appearance: appearance.titleAppearance)
|
||||
subtitleView.configureUILabel(appearance: appearance.subtitleAppearance)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIUIElements'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Bunch of useful protocols and views.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIUIKitCore'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Core UI elements: protocols, views and helpers.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIWebView'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Universal web view API'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIYandexMapUtils'
|
||||
s.version = '1.54.0'
|
||||
s.version = '1.54.1'
|
||||
s.summary = 'Set of helpers for map objects clustering and interacting using Yandex Maps SDK.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/src/tag/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
Loading…
Reference in New Issue