diff --git a/CHANGELOG.md b/CHANGELOG.md index b9d5e703..f48c6887 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,12 @@ # Changelog +### 1.42.0 + +- **Added**: TIDeeplink to support deeplink API + ### 1.41.0 -- **Added**: TIDeeplink to support deeplink API +- **Update**: added callbacks for views while skeletons change status to presented or hidden ### 1.40.0 diff --git a/TIAppleMapUtils/TIAppleMapUtils.podspec b/TIAppleMapUtils/TIAppleMapUtils.podspec index 04e5a334..62abf991 100644 --- a/TIAppleMapUtils/TIAppleMapUtils.podspec +++ b/TIAppleMapUtils/TIAppleMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIAppleMapUtils' - s.version = '1.40.0' + s.version = '1.41.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 4a25f30e..9af515b0 100644 --- a/TIAuth/TIAuth.podspec +++ b/TIAuth/TIAuth.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIAuth' - s.version = '1.40.0' + s.version = '1.42.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 94c0af39..693d6107 100644 --- a/TIDeveloperUtils/TIDeveloperUtils.podspec +++ b/TIDeveloperUtils/TIDeveloperUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIDeveloperUtils' - s.version = '1.40.0' + s.version = '1.41.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 ca618545..9a3116d7 100644 --- a/TIEcommerce/TIEcommerce.podspec +++ b/TIEcommerce/TIEcommerce.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIEcommerce' - s.version = '1.40.0' + s.version = '1.41.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 fe121109..18c9a0ba 100644 --- a/TIFoundationUtils/TIFoundationUtils.podspec +++ b/TIFoundationUtils/TIFoundationUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIFoundationUtils' - s.version = '1.40.0' + s.version = '1.42.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 e03444b9..2f0358a8 100644 --- a/TIGoogleMapUtils/TIGoogleMapUtils.podspec +++ b/TIGoogleMapUtils/TIGoogleMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIGoogleMapUtils' - s.version = '1.40.0' + s.version = '1.41.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 f211ca7d..b9ede117 100644 --- a/TIKeychainUtils/TIKeychainUtils.podspec +++ b/TIKeychainUtils/TIKeychainUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIKeychainUtils' - s.version = '1.40.0' + s.version = '1.42.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 6a78ddd0..f8aa2d12 100644 --- a/TIMapUtils/TIMapUtils.podspec +++ b/TIMapUtils/TIMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIMapUtils' - s.version = '1.40.0' + s.version = '1.41.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 9157d4fb..48989acc 100644 --- a/TIMoyaNetworking/TIMoyaNetworking.podspec +++ b/TIMoyaNetworking/TIMoyaNetworking.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIMoyaNetworking' - s.version = '1.40.0' + s.version = '1.41.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 77132491..d3cb51e4 100644 --- a/TINetworking/TINetworking.podspec +++ b/TINetworking/TINetworking.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TINetworking' - s.version = '1.40.0' + s.version = '1.42.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 5ea18467..7c6f108d 100644 --- a/TINetworkingCache/TINetworkingCache.podspec +++ b/TINetworkingCache/TINetworkingCache.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TINetworkingCache' - s.version = '1.40.0' + s.version = '1.42.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 5bfaba1b..29cf019b 100644 --- a/TIPagination/TIPagination.podspec +++ b/TIPagination/TIPagination.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIPagination' - s.version = '1.40.0' + s.version = '1.42.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 6c399c22..cc9aa89a 100644 --- a/TISwiftUICore/TISwiftUICore.podspec +++ b/TISwiftUICore/TISwiftUICore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TISwiftUICore' - s.version = '1.40.0' + s.version = '1.42.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 b4acb6c6..b84ff47f 100644 --- a/TISwiftUtils/TISwiftUtils.podspec +++ b/TISwiftUtils/TISwiftUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TISwiftUtils' - s.version = '1.40.0' + s.version = '1.42.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 13ad427d..d0b561e4 100644 --- a/TITableKitUtils/TITableKitUtils.podspec +++ b/TITableKitUtils/TITableKitUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TITableKitUtils' - s.version = '1.40.0' + s.version = '1.42.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/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/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..56e8e3cd 100644 --- a/TIUIElements/Sources/Views/Skeletons/SkeletonLayer.swift +++ b/TIUIElements/Sources/Views/Skeletons/SkeletonLayer.swift @@ -65,9 +65,11 @@ 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 baseView: UIView? public var isAnimating: Bool { animationLayer.animation(forKey: Constants.animationKeyPath) != nil @@ -82,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() } @@ -98,6 +100,8 @@ open class SkeletonLayer: CAShapeLayer { // MARK: - Open methods open func bind(to viewType: ViewType) { + layerOwnerView = 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 = layerOwnerView 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() { @@ -163,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): 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.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/TIUIElements/TIUIElements.podspec b/TIUIElements/TIUIElements.podspec index 8ab4a684..5a2ebe0e 100644 --- a/TIUIElements/TIUIElements.podspec +++ b/TIUIElements/TIUIElements.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIUIElements' - s.version = '1.40.0' + s.version = '1.42.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' } @@ -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/**/*' + 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 diff --git a/TIUIKitCore/TIUIKitCore.podspec b/TIUIKitCore/TIUIKitCore.podspec index 7c6bf57d..6f43e351 100644 --- a/TIUIKitCore/TIUIKitCore.podspec +++ b/TIUIKitCore/TIUIKitCore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIUIKitCore' - s.version = '1.40.0' + s.version = '1.42.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 3d7826d6..8b9c3739 100644 --- a/TIWebView/TIWebView.podspec +++ b/TIWebView/TIWebView.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIWebView' - s.version = '1.40.0' + s.version = '1.41.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 f2905293..18721a70 100644 --- a/TIYandexMapUtils/TIYandexMapUtils.podspec +++ b/TIYandexMapUtils/TIYandexMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIYandexMapUtils' - s.version = '1.40.0' + s.version = '1.41.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' } 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