Don_Mag

Untitled

Jun 27th, 2022 (edited)
872
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.57 KB | None | 0 0
  1.     private func showWarningView() {
  2.        
  3.         DispatchQueue.main.async { [weak self] in
  4.            
  5.             guard let self = self else { return }
  6.            
  7.             var newConstant: CGFloat!
  8.            
  9.             if self.warningViewTopConstraint.constant == 0.0 {
  10.                 newConstant = 100.0
  11.             } else {
  12.                 newConstant = 0.0
  13.             }
  14.            
  15.             self.warningViewTopConstraint.constant = newConstant
  16.            
  17.             UIView.animate(withDuration: 0.25, delay: 0.0, options: .curveEaseIn, animations: { [weak self] in
  18.                 guard let self = self else { return }
  19.                 self.view.layoutIfNeeded()
  20.             }, completion: nil)
  21.            
  22.         }
  23.        
  24.     }
  25.  
Add Comment
Please, Sign In to add comment