Skip to content

Commit

Permalink
Added extra animations option for left/right stack view width constra…
Browse files Browse the repository at this point in the history
…ints
  • Loading branch information
carlsondev committed Dec 12, 2021
1 parent 246155f commit 04afb45
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Sources/InputBarAccessoryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -785,11 +785,15 @@ open class InputBarAccessoryView: UIView {
/// - Parameters:
/// - newValue: New widthAnchor constant
/// - animated: If the layout should be animated
open func setLeftStackViewWidthConstant(to newValue: CGFloat, animated: Bool) {
/// - extraAnimations: Any extra operations that should also be animated
open func setLeftStackViewWidthConstant(to newValue: CGFloat, animated: Bool, extraAnimations : (() -> Void)? = nil) {
performLayout(animated) {
self.leftStackViewWidthConstant = newValue
self.layoutStackViews([.left])
self.layoutContainerViewIfNeeded()
if let animations = extraAnimations{
animations()
}
}
}

Expand All @@ -798,11 +802,15 @@ open class InputBarAccessoryView: UIView {
/// - Parameters:
/// - newValue: New widthAnchor constant
/// - animated: If the layout should be animated
open func setRightStackViewWidthConstant(to newValue: CGFloat, animated: Bool) {
/// - extraAnimations: Any extra operations that should also be animated
open func setRightStackViewWidthConstant(to newValue: CGFloat, animated: Bool, extraAnimations : (() -> Void)? = nil) {
performLayout(animated) {
self.rightStackViewWidthConstant = newValue
self.layoutStackViews([.right])
self.layoutContainerViewIfNeeded()
if let animations = extraAnimations{
animations()
}
}
}

Expand Down

0 comments on commit 04afb45

Please sign in to comment.