marinofaggiana 4 년 전
부모
커밋
c2492b12e0
1개의 변경된 파일16개의 추가작업 그리고 0개의 파일을 삭제
  1. 16 0
      iOSClient/Main/NCMainNavigationController.swift

+ 16 - 0
iOSClient/Main/NCMainNavigationController.swift

@@ -25,6 +25,8 @@ import Foundation
 
 class NCMainNavigationController: UINavigationController {
     
+    var isPushing = false
+
     required init?(coder: NSCoder) {
         super.init(coder: coder)
         
@@ -33,6 +35,20 @@ class NCMainNavigationController: UINavigationController {
         changeTheming()
     }
     
+    // https://stackoverflow.com/questions/37829721/pushing-view-controller-twice
+    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
+        
+        if !isPushing {
+            isPushing = true
+            CATransaction.begin()
+            CATransaction.setCompletionBlock {
+                self.isPushing = false
+            }
+            super.pushViewController(viewController, animated: animated)
+            CATransaction.commit()
+        }
+    }
+    
     @objc func changeTheming() {
                   
         if #available(iOS 13.0, *) {