-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
杨光
committed
Apr 26, 2024
1 parent
bbbbb02
commit c1e9cb8
Showing
5 changed files
with
93 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+22.9 KB
(110%)
...e.xcodeproj/project.xcworkspace/xcuserdata/sun.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
CardTransition-Example/Util/Extension/UIViewController+TopVC.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// UIViewController+TopVC.swift | ||
// CardTransition-Example | ||
// | ||
// Created by Sun on 2024/4/26. | ||
// | ||
|
||
import UIKit | ||
|
||
extension UIViewController { | ||
|
||
/// 顶层 vc | ||
public var topVC: UIViewController { | ||
if let vc = self.presentedViewController { | ||
return vc.topVC | ||
} else if let tabVC = self as? UITabBarController, | ||
let vc = tabVC.selectedViewController { | ||
return vc.topVC | ||
|
||
} else if let nav = self as? UINavigationController, | ||
let vc = nav.visibleViewController { | ||
return vc.topVC | ||
} | ||
return self | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters