Skip to content

Instantly share code, notes, and snippets.

View orangeince's full-sized avatar
🤠
Code the life

Shao orangeince

🤠
Code the life
View GitHub Profile
@orangeince
orangeince / iOS+Extension.swift
Created February 14, 2019 03:34
记录一些iOS里方便的扩展方法
// MARK: UIViewController
extension UIViewController {
static var topMost: UIViewController? {
var top = UIApplication.shared.keyWindow?.rootViewController
while true {
if let presented = top?.presentedViewController {
top = presented
} else if let nav = top as? UINavigationController {
top = nav.visibleViewController
} else if let tab = top as? UITabBarController {