SwiftEntryKit
SwiftEntryKit copied to clipboard
Animated update frame
Describe the bug
There is an issue in SwiftEntryKit with animated updating frame of alert.
For example if my attribute has
attributes.positionConstraints.size = .init(width: .fill, height: .intrinsic)
and then increase height of some view inside my alert view like:
someViewHeightConstraint.constant += 80
UIView.animate(withDuration: 0.3) {
self.layoutIfNeeded()
}
superView will increase height instantly although alert view will be animated.
Screenshots If applicable, add screenshots to help explain your problem.
iPhone (please complete the following information):
- Device: Any
- iOS Version: tested on iOS 12
- Xcode Version 10.2
- SwiftEntryKit Release # 1.0
Screenshots / Video Links Sent video to your email.
You should replace self.layoutIfNeeded() with SwiftEntryKit.layoutIfNeeded().
Thanks. Yes, with SwiftEntryKit.layoutIfNeeded() it works, but with SwiftEntryKit.layoutIfNeeded() there is another issue, with safe area now. Attribute has:
attributes.entryBackground = .color(color: someColor)
attributes.positionConstraints.safeArea = .empty(fillSafeArea: true)
and when alert decrease height safe area is blinking. (sent video to your email.)
Oh, it's not related safe area. On iPhone 7 the same issue with bottom blank space.
@huri000 Hello! Sorry to disturb you, but have you had a chance to look at this issue? (with bottom blank space when view is decreasing height.) Thank you so much
Hi @Banck. No. Couldn't reproduce it. I suspect that this is your view's constraints colliding with the framework. If you are were able to send me a reproducible sample project, it would be helpful.
Strange, because if set entryBackground to clear and set background color to my view - everything is fine
View is like: UIVIew: -UILabel -UIView (dynamic height) -UILabel
and all subview has vertical space to each other and we increase, decrease height of UIView (dynamic height)
@huri000 finally, I found where is an issue. If set roundCorners EntryKit does something like that:
let path = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
let mask = CAShapeLayer()
mask.path = path.cgPath
layer.mask = mask
and when height was decreased, mask bounds wasn't. Seems this is the reason
If remove roundCorners everything is fine.
I've looked at your code, saw that you call applyFrameStyle in layoutSubviews. So seems that's not the reason, but if set roundCorners to .none, everything is fine.
@huri000 Hello! Here is a sample project EntryDemo.zip
Thanks, @Banck! I'll investigate and let you know of any findings.
Hey, have you had a chance to consider this issue? Thank you!