fix: code review notes

This commit is contained in:
Nikita Semenov 2023-03-09 22:01:45 +03:00
parent 2250b1b4d9
commit 40aa2876d1
2 changed files with 9 additions and 6 deletions

View File

@ -78,7 +78,7 @@ extension UIView {
return .parentView(self)
} else {
return .anyFinalView(self)
return .leafView(self)
}
}

View File

@ -36,7 +36,7 @@ open class SkeletonLayer: CAShapeLayer {
case imageView(UIImageView)
case textView(UITextView)
case label(UILabel)
case anyFinalView(UIView)
case leafView(UIView)
public var view: UIView {
switch self {
@ -52,7 +52,7 @@ open class SkeletonLayer: CAShapeLayer {
case let .textView(textView):
return textView
case let .anyFinalView(view):
case let .leafView(view):
return view
case let .skeletonsHolderView(view):
@ -121,8 +121,11 @@ open class SkeletonLayer: CAShapeLayer {
open func remove(from view: UIView) {
stopAnimation()
removeFromSuperlayer()
viewBoundsObservation = nil
applicationStateObservation = nil
viewBoundsObservation?.invalidate()
if let observation = applicationStateObservation {
NotificationCenter.default.removeObserver(observation)
}
}
open func startAnimation() {
@ -187,7 +190,7 @@ open class SkeletonLayer: CAShapeLayer {
let viewFrame = CGRect(origin: rect.origin, size: path?.boundingBox.size ?? rect.size)
frame = configuration.containerViewConfiguration.applyPadding(viewFrame: viewFrame)
case .anyFinalView(_):
case .leafView(_):
path = configuration.viewConfiguration.drawPath(rect: viewType.view.bounds)
let viewFrame = CGRect(origin: rect.origin, size: path?.boundingBox.size ?? rect.size)