Files
Woka_Native_iOS/WOKA/Helpers/PopViewControllerGeneric.swift
BilalKhanWDI 750cc59cde - handled theme 2 player pause while the radio is opened and closed
- Completed forget username flow with hindi language
- Completed app update functionality, need the api to be updated as the version will not be a double, its going to be string
2024-08-20 19:50:11 +05:30

23 lines
626 B
Swift

//
// PopViewControllerGeneric.swift
// WOKA
//
// Created by MacBook Pro on 20/08/24.
//
import UIKit
/*
this helps in navigation back or pop the viewcontroller as generic type
*/
extension UINavigationController {
func getViewController<T: UIViewController>(of type: T.Type) -> UIViewController? {
return self.viewControllers.first(where: { $0 is T })
}
func popToViewController<T: UIViewController>(of type: T.Type, animated: Bool) {
guard let viewController = self.getViewController(of: type) else { return }
self.popToViewController(viewController, animated: animated)
}
}