feat: added callbacks for views when skeletons status changed
This commit is contained in:
parent
2f71b10dc0
commit
76da4ab223
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
|
|
@ -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' }
|
||||
|
|
|
|||
Loading…
Reference in New Issue