@@ -10,7 +10,7 @@ import UIKit
1010import MessageStackView
1111
1212class MessageViewController : UIViewController {
13-
13+
1414 private lazy var messageStackView : MessageStackView = {
1515 let messageStackView : MessageStackView = view. createMessageStackView ( )
1616 messageStackView. messageConfiguation = MessageConfiguration (
@@ -21,7 +21,7 @@ class MessageViewController: UIViewController {
2121 )
2222 return messageStackView
2323 } ( )
24-
24+
2525 override func viewDidAppear( _ animated: Bool ) {
2626 super. viewDidAppear ( animated)
2727
@@ -31,7 +31,7 @@ class MessageViewController: UIViewController {
3131 subtitle: " This is a subtitle, with a left image " ,
3232 leftImage: . information
3333 ) , dismissAfter: 6 )
34-
34+
3535 // Post another message after delay
3636 DispatchQueue . main. asyncAfterNow ( time: . seconds( 2 ) ) { [ weak self] in
3737 guard let self = self else { return }
@@ -44,19 +44,19 @@ class MessageViewController: UIViewController {
4444 ) ,
4545 dismissAfter: 8
4646 )
47-
47+
4848 messageView. rightImageViewSize = CGSize ( width: 10 , height: 10 )
4949 self . addTapToRemoveGesture ( to: messageView)
5050 }
51-
51+
5252 // Post a custom view after delay
5353 DispatchQueue . main. asyncAfterNow ( time: . seconds( 4 ) ) { [ weak self] in
5454 let view = CustomView ( )
5555 self ? . messageStackView. post ( view: view)
5656 self ? . addTapToRemoveGesture ( to: view)
5757 }
5858 }
59-
59+
6060 /// Add ability to remove `view` from `messageStackView` by tap
6161 ///
6262 /// - Parameter view: `UIView`
@@ -68,21 +68,22 @@ class MessageViewController: UIViewController {
6868
6969// MARK: - CustomView
7070
71- fileprivate class CustomView : UIView {
72-
71+ private class CustomView : UIView {
72+
7373 init ( ) {
7474 super. init ( frame: . zero)
7575 backgroundColor = . blue
76-
76+
7777 translatesAutoresizingMaskIntoConstraints = false
7878 let heightConstraint = heightAnchor. constraint ( equalToConstant: 50 )
79-
79+
8080 // Allow the height to be defined by the stackView during animation
8181 heightConstraint. priority = . init( 999 )
82-
82+
8383 heightConstraint. isActive = true
8484 }
85-
85+
86+ @available ( * , unavailable)
8687 required init ? ( coder: NSCoder ) {
8788 fatalError ( " init(coder:) has not been implemented " )
8889 }
0 commit comments