From 76da4ab223dbdf2e9cfcf84a97ab68085d622925 Mon Sep 17 00:00:00 2001 From: Nikita Semenov Date: Tue, 28 Mar 2023 13:15:07 +0300 Subject: [PATCH 1/5] feat: added callbacks for views when skeletons status changed --- CHANGELOG.md | 4 ++++ TIAppleMapUtils/TIAppleMapUtils.podspec | 2 +- TIAuth/TIAuth.podspec | 2 +- TIDeveloperUtils/TIDeveloperUtils.podspec | 2 +- TIEcommerce/TIEcommerce.podspec | 2 +- TIFoundationUtils/TIFoundationUtils.podspec | 2 +- TIGoogleMapUtils/TIGoogleMapUtils.podspec | 2 +- TIKeychainUtils/TIKeychainUtils.podspec | 2 +- TIMapUtils/TIMapUtils.podspec | 2 +- TIMoyaNetworking/TIMoyaNetworking.podspec | 2 +- TINetworking/TINetworking.podspec | 2 +- TINetworkingCache/TINetworkingCache.podspec | 2 +- TIPagination/TIPagination.podspec | 2 +- TISwiftUICore/TISwiftUICore.podspec | 2 +- TISwiftUtils/TISwiftUtils.podspec | 2 +- TITableKitUtils/TITableKitUtils.podspec | 2 +- .../Skeletons/Protocols/Skeletonable.swift | 16 ++++++++++++++++ .../Sources/Views/Skeletons/SkeletonLayer.swift | 14 ++++++++++++++ .../Skeletons/UIView+PresentingSkeletons.swift | 17 +++++++++++++++-- TIUIElements/TIUIElements.podspec | 2 +- TIUIKitCore/TIUIKitCore.podspec | 2 +- TIWebView/TIWebView.podspec | 2 +- TIYandexMapUtils/TIYandexMapUtils.podspec | 2 +- 23 files changed, 68 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4eb962b5..9e197adf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### 1.40.0 + +- **Update**: added callbacks for views while skeletons change status to presented or hidden + ### 1.39.0 - **Added**: UIButton Appearance model diff --git a/TIAppleMapUtils/TIAppleMapUtils.podspec b/TIAppleMapUtils/TIAppleMapUtils.podspec index 837ddc85..04e5a334 100644 --- a/TIAppleMapUtils/TIAppleMapUtils.podspec +++ b/TIAppleMapUtils/TIAppleMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIAppleMapUtils' - s.version = '1.39.0' + s.version = '1.40.0' 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 884ed177..4a25f30e 100644 --- a/TIAuth/TIAuth.podspec +++ b/TIAuth/TIAuth.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIAuth' - s.version = '1.39.0' + s.version = '1.40.0' 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 8c4e076b..94c0af39 100644 --- a/TIDeveloperUtils/TIDeveloperUtils.podspec +++ b/TIDeveloperUtils/TIDeveloperUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIDeveloperUtils' - s.version = '1.39.0' + s.version = '1.40.0' 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 f6696364..ca618545 100644 --- a/TIEcommerce/TIEcommerce.podspec +++ b/TIEcommerce/TIEcommerce.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIEcommerce' - s.version = '1.39.0' + s.version = '1.40.0' 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 3dd87f16..fe121109 100644 --- a/TIFoundationUtils/TIFoundationUtils.podspec +++ b/TIFoundationUtils/TIFoundationUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIFoundationUtils' - s.version = '1.39.0' + s.version = '1.40.0' 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 f5e13de7..e03444b9 100644 --- a/TIGoogleMapUtils/TIGoogleMapUtils.podspec +++ b/TIGoogleMapUtils/TIGoogleMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIGoogleMapUtils' - s.version = '1.39.0' + s.version = '1.40.0' 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 25c4fa16..f211ca7d 100644 --- a/TIKeychainUtils/TIKeychainUtils.podspec +++ b/TIKeychainUtils/TIKeychainUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIKeychainUtils' - s.version = '1.39.0' + s.version = '1.40.0' 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 94019482..6a78ddd0 100644 --- a/TIMapUtils/TIMapUtils.podspec +++ b/TIMapUtils/TIMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIMapUtils' - s.version = '1.39.0' + s.version = '1.40.0' 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 c8d020a5..9157d4fb 100644 --- a/TIMoyaNetworking/TIMoyaNetworking.podspec +++ b/TIMoyaNetworking/TIMoyaNetworking.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIMoyaNetworking' - s.version = '1.39.0' + s.version = '1.40.0' 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 e26aa3b6..77132491 100644 --- a/TINetworking/TINetworking.podspec +++ b/TINetworking/TINetworking.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TINetworking' - s.version = '1.39.0' + s.version = '1.40.0' 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 3292f422..5ea18467 100644 --- a/TINetworkingCache/TINetworkingCache.podspec +++ b/TINetworkingCache/TINetworkingCache.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TINetworkingCache' - s.version = '1.39.0' + s.version = '1.40.0' 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 c2327dde..5bfaba1b 100644 --- a/TIPagination/TIPagination.podspec +++ b/TIPagination/TIPagination.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIPagination' - s.version = '1.39.0' + s.version = '1.40.0' 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 cad3bd44..6c399c22 100644 --- a/TISwiftUICore/TISwiftUICore.podspec +++ b/TISwiftUICore/TISwiftUICore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TISwiftUICore' - s.version = '1.39.0' + s.version = '1.40.0' 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 f610dc08..b4acb6c6 100644 --- a/TISwiftUtils/TISwiftUtils.podspec +++ b/TISwiftUtils/TISwiftUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TISwiftUtils' - s.version = '1.39.0' + s.version = '1.40.0' 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 e7cdf5c4..13ad427d 100644 --- a/TITableKitUtils/TITableKitUtils.podspec +++ b/TITableKitUtils/TITableKitUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TITableKitUtils' - s.version = '1.39.0' + s.version = '1.40.0' 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/Views/Skeletons/Protocols/Skeletonable.swift b/TIUIElements/Sources/Views/Skeletons/Protocols/Skeletonable.swift index 4c5f2d9e..454bcf6d 100644 --- a/TIUIElements/Sources/Views/Skeletons/Protocols/Skeletonable.swift +++ b/TIUIElements/Sources/Views/Skeletons/Protocols/Skeletonable.swift @@ -24,4 +24,20 @@ import class UIKit.UIView public protocol Skeletonable { var viewsToSkeletons: [UIView] { get } + func skeletonsChangedState(_ state: SkeletonsState) +} + +extension Skeletonable where Self: UIView { + public var viewsToSkeletons: [UIView] { + subviews + } + + public func skeletonsChangedState(_ state: SkeletonsState) { + // Empty realization + } +} + +public enum SkeletonsState { + case shown + case hidden } diff --git a/TIUIElements/Sources/Views/Skeletons/SkeletonLayer.swift b/TIUIElements/Sources/Views/Skeletons/SkeletonLayer.swift index 758765ff..5cd408c8 100644 --- a/TIUIElements/Sources/Views/Skeletons/SkeletonLayer.swift +++ b/TIUIElements/Sources/Views/Skeletons/SkeletonLayer.swift @@ -67,6 +67,8 @@ open class SkeletonLayer: CAShapeLayer { public var configuration: SkeletonsConfiguration public var isSkeletonsHolder: Bool = false + + public weak var convertedView: UIView? public weak var baseView: UIView? public var isAnimating: Bool { @@ -98,6 +100,8 @@ open class SkeletonLayer: CAShapeLayer { // MARK: - Open methods open func bind(to viewType: ViewType) { + convertedView = viewType.view + configureAppearance(viewType) updateGeometry(viewType: viewType) @@ -118,6 +122,14 @@ open class SkeletonLayer: CAShapeLayer { configuration.configurationDelegate?.layerDidConfigured(self, forViewType: viewType) } + open func skeletonsChangedState(_ state: SkeletonsState) { + guard let skeletonableView = convertedView as? Skeletonable else { + return + } + + skeletonableView.skeletonsChangedState(state) + } + open func remove(from view: UIView) { stopAnimation() removeFromSuperlayer() @@ -126,6 +138,8 @@ open class SkeletonLayer: CAShapeLayer { if let observation = applicationStateObservation { NotificationCenter.default.removeObserver(observation) } + + skeletonsChangedState(.hidden) } open func startAnimation() { diff --git a/TIUIElements/Sources/Views/Skeletons/UIView+PresentingSkeletons.swift b/TIUIElements/Sources/Views/Skeletons/UIView+PresentingSkeletons.swift index 47f49706..62684133 100644 --- a/TIUIElements/Sources/Views/Skeletons/UIView+PresentingSkeletons.swift +++ b/TIUIElements/Sources/Views/Skeletons/UIView+PresentingSkeletons.swift @@ -50,6 +50,7 @@ extension UIView { return layer } .insert(onto: self) + .skeletonsShown() } public func hideSkeletons() { @@ -104,10 +105,22 @@ extension UIView { // MARK: - Helper extension -extension Array where Element: CALayer { - public func insert(onto view: UIView, at index: UInt32 = .max) { +extension Array where Element: SkeletonLayer { + @discardableResult + public func skeletonsShown() -> Self { + self.forEach { subLayer in + subLayer.skeletonsChangedState(.shown) + } + + return self + } + + @discardableResult + public func insert(onto view: UIView, at index: UInt32 = .max) -> Self { self.forEach { subLayer in view.layer.insertSublayer(subLayer, at: index) } + + return self } } diff --git a/TIUIElements/TIUIElements.podspec b/TIUIElements/TIUIElements.podspec index 929a4d54..8ab4a684 100644 --- a/TIUIElements/TIUIElements.podspec +++ b/TIUIElements/TIUIElements.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIUIElements' - s.version = '1.39.0' + s.version = '1.40.0' 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/TIUIKitCore.podspec b/TIUIKitCore/TIUIKitCore.podspec index b62c7eb6..7c6bf57d 100644 --- a/TIUIKitCore/TIUIKitCore.podspec +++ b/TIUIKitCore/TIUIKitCore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIUIKitCore' - s.version = '1.39.0' + s.version = '1.40.0' 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 9e3654b8..3d7826d6 100644 --- a/TIWebView/TIWebView.podspec +++ b/TIWebView/TIWebView.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIWebView' - s.version = '1.39.0' + s.version = '1.40.0' 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 d832db7e..f2905293 100644 --- a/TIYandexMapUtils/TIYandexMapUtils.podspec +++ b/TIYandexMapUtils/TIYandexMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIYandexMapUtils' - s.version = '1.39.0' + s.version = '1.40.0' 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' } From 05a6236425b9f276a2ebe1034a0d31d249870783 Mon Sep 17 00:00:00 2001 From: Nikita Semenov Date: Wed, 29 Mar 2023 10:00:22 +0300 Subject: [PATCH 2/5] fix: podfile for TIUIElements --- TIUIElements/TIUIElements.podspec | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/TIUIElements/TIUIElements.podspec b/TIUIElements/TIUIElements.podspec index 8f5742f9..c7388d8a 100644 --- a/TIUIElements/TIUIElements.podspec +++ b/TIUIElements/TIUIElements.podspec @@ -11,7 +11,14 @@ Pod::Spec.new do |s| s.ios.deployment_target = '11.0' s.swift_versions = ['5.3'] - s.source_files = s.name + '/Sources/**/*' + sources = '**/Sources/**/*.swift' + if ENV["DEVELOPMENT_INSTALL"] # installing using :path => + s.source_files = sources + s.exclude_files = s.name + '.app' + else + s.source_files = s.name + '/' + sources + s.exclude_files = s.name + '/*.app' + end s.dependency 'TIUIKitCore', s.version.to_s s.dependency 'TISwiftUtils', s.version.to_s From 39bad32c492fac04c4ef9776eb7011efc08a4911 Mon Sep 17 00:00:00 2001 From: Nikita Semenov Date: Wed, 29 Mar 2023 11:50:48 +0300 Subject: [PATCH 3/5] fix: changed names of views properties in SkeletonLayer --- .../Configuration/SkeletonsConfiguration.swift | 2 +- .../Sources/Views/Skeletons/SkeletonLayer.swift | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/TIUIElements/Sources/Views/Skeletons/Configuration/SkeletonsConfiguration.swift b/TIUIElements/Sources/Views/Skeletons/Configuration/SkeletonsConfiguration.swift index c46c8e62..46c41ec3 100644 --- a/TIUIElements/Sources/Views/Skeletons/Configuration/SkeletonsConfiguration.swift +++ b/TIUIElements/Sources/Views/Skeletons/Configuration/SkeletonsConfiguration.swift @@ -66,7 +66,7 @@ open class SkeletonsConfiguration { // MARK: - Open methods open func createSkeletonLayer(for baseView: UIView) -> SkeletonLayer { - SkeletonLayer(config: self, baseView: baseView) + SkeletonLayer(config: self, skeletonsPresenterView: baseView) } open func configureAppearance(layer: SkeletonLayer) { diff --git a/TIUIElements/Sources/Views/Skeletons/SkeletonLayer.swift b/TIUIElements/Sources/Views/Skeletons/SkeletonLayer.swift index 5cd408c8..56e8e3cd 100644 --- a/TIUIElements/Sources/Views/Skeletons/SkeletonLayer.swift +++ b/TIUIElements/Sources/Views/Skeletons/SkeletonLayer.swift @@ -65,12 +65,12 @@ open class SkeletonLayer: CAShapeLayer { private var viewBoundsObservation: NSKeyValueObservation? private var applicationStateObservation: NSObjectProtocol? + private weak var layerOwnerView: UIView? + private weak var skeletonsPresenterView: UIView? + public var configuration: SkeletonsConfiguration public var isSkeletonsHolder: Bool = false - public weak var convertedView: UIView? - public weak var baseView: UIView? - public var isAnimating: Bool { animationLayer.animation(forKey: Constants.animationKeyPath) != nil } @@ -84,9 +84,9 @@ open class SkeletonLayer: CAShapeLayer { super.init(layer: layer) } - public init(config: SkeletonsConfiguration, baseView: UIView) { + public init(config: SkeletonsConfiguration, skeletonsPresenterView: UIView) { self.configuration = config - self.baseView = baseView + self.skeletonsPresenterView = skeletonsPresenterView super.init() } @@ -100,7 +100,7 @@ open class SkeletonLayer: CAShapeLayer { // MARK: - Open methods open func bind(to viewType: ViewType) { - convertedView = viewType.view + layerOwnerView = viewType.view configureAppearance(viewType) updateGeometry(viewType: viewType) @@ -123,7 +123,7 @@ open class SkeletonLayer: CAShapeLayer { } open func skeletonsChangedState(_ state: SkeletonsState) { - guard let skeletonableView = convertedView as? Skeletonable else { + guard let skeletonableView = layerOwnerView as? Skeletonable else { return } @@ -177,7 +177,7 @@ open class SkeletonLayer: CAShapeLayer { } private func updateGeometry(viewType: ViewType) { - let rect = viewType.view.convert(viewType.view.bounds, to: baseView) + let rect = viewType.view.convert(viewType.view.bounds, to: skeletonsPresenterView) switch viewType { case let .textView(textView): From 775f95a9317f8a5b22caf3c8f4983dfb1f087140 Mon Sep 17 00:00:00 2001 From: Nikita Semenov Date: Wed, 29 Mar 2023 15:28:38 +0300 Subject: [PATCH 4/5] fix: podspecs file for TIUIElements --- TIUIElements/TIUIElements.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TIUIElements/TIUIElements.podspec b/TIUIElements/TIUIElements.podspec index c7388d8a..9b841ec8 100644 --- a/TIUIElements/TIUIElements.podspec +++ b/TIUIElements/TIUIElements.podspec @@ -11,12 +11,12 @@ Pod::Spec.new do |s| s.ios.deployment_target = '11.0' s.swift_versions = ['5.3'] - sources = '**/Sources/**/*.swift' + sources = '/Sources/**/*' if ENV["DEVELOPMENT_INSTALL"] # installing using :path => s.source_files = sources s.exclude_files = s.name + '.app' else - s.source_files = s.name + '/' + sources + s.source_files = s.name + sources s.exclude_files = s.name + '/*.app' end From 8d253d1458493d28c3fafcf5c19c855a3cb17574 Mon Sep 17 00:00:00 2001 From: Nikita Semenov Date: Thu, 30 Mar 2023 15:07:43 +0300 Subject: [PATCH 5/5] docs: added documentation for new Skeletonable callbacks API --- .../Skeletons.xcplaygroundpage/Contents.swift | 13 +++++++++++++ docs/tiuielements/skeletons.md | 16 ++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/TIUIElements/TIUIElements.app/Contents/MacOS/TIUIElements.playground/Pages/Skeletons.xcplaygroundpage/Contents.swift b/TIUIElements/TIUIElements.app/Contents/MacOS/TIUIElements.playground/Pages/Skeletons.xcplaygroundpage/Contents.swift index 5a8a9f4c..d2bb6abd 100644 --- a/TIUIElements/TIUIElements.app/Contents/MacOS/TIUIElements.playground/Pages/Skeletons.xcplaygroundpage/Contents.swift +++ b/TIUIElements/TIUIElements.app/Contents/MacOS/TIUIElements.playground/Pages/Skeletons.xcplaygroundpage/Contents.swift @@ -302,6 +302,19 @@ DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(3)) { titleSubtitleView.hideSkeletons() } +//: Если на конкретной view необходимо отслеживать появление скелетонов, то можно законформить ее под протокол Skeletonable: +extension DefaultPlaceholderImageView: Skeletonable { + public func skeletonsChangedState(_ state: SkeletonsState) { + switch state { + case .shown: + placeholderView.isHidden = false + + case .hidden: + placeholderView.isHidden = true + } + } +} + //: ## Тестовый сконфигурированный контроллер import PlaygroundSupport diff --git a/docs/tiuielements/skeletons.md b/docs/tiuielements/skeletons.md index 0fd4d72a..a8dad19a 100644 --- a/docs/tiuielements/skeletons.md +++ b/docs/tiuielements/skeletons.md @@ -324,6 +324,22 @@ DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(3)) { } ``` +Если на конкретной view необходимо отслеживать появление скелетонов, то можно законформить ее под протокол Skeletonable: + +```swift +extension DefaultPlaceholderImageView: Skeletonable { + public func skeletonsChangedState(_ state: SkeletonsState) { + switch state { + case .shown: + placeholderView.isHidden = false + + case .hidden: + placeholderView.isHidden = true + } + } +} +``` + ## Тестовый сконфигурированный контроллер ```swift