Navigate
@available(iOS 9.0, *)
public class Navigate
An object to help with navigation.
-
Different types of Navigation Style
See moreDeclaration
Swift
public enum NavigationStyle -
Different types of Toast Style
See moreDeclaration
Swift
public enum ToastStyle -
The statically shared instance of Navigate
Declaration
Swift
public static var shared: Navigate -
Create a Navigate object to manage navigation
Declaration
Swift
public init(controller: UINavigationController? = nil)Parameters
controllerAn optional UINavigationController to handle navigation (Default: nil)
-
Configure the Navigate Singleton with the Root Navigation Controller
Declaration
Swift
@discardableResult public func configure(controller: UINavigationController?) -> Self -
Set the visibleViewController’s title
Declaration
Swift
@discardableResult public func set(title: String) -> SelfParameters
titleThe title of the currentViewController
-
Set the left barButton
Declaration
Swift
@discardableResult public func setLeft(barButton: UIBarButtonItem?, animated: Bool = true) -> SelfParameters
barButtonThe UIBarButtonItem to be set
animatedShould animate setting the left UIBarButtonItem (Default: true)
-
Set the right barButton
Declaration
Swift
@discardableResult public func setRight(barButton: UIBarButtonItem?, animated: Bool = true) -> SelfParameters
barButtonThe UIBarButtonItem to be set
animatedShould animate setting the right UIBarButtonItem (Default: true)
-
Set the left barButtons
Declaration
Swift
@discardableResult public func setLeft(barButtons: [UIBarButtonItem]?, animated: Bool = true) -> SelfParameters
barButtonThe [UIBarButtonItem] to be set
animatedShould animate setting the left UIBarButtonItem
-
Set the right barButtons
Declaration
Swift
@discardableResult public func setRight(barButtons: [UIBarButtonItem]?, animated: Bool = true) -> SelfParameters
barButtonThe [UIBarButtonItem] to be set
animatedShould animate setting the right UIBarButtonItem
-
Go to a viewController by using the configured NavigationController
Declaration
Swift
public func go( _ viewController: UIViewController, style: NavigationStyle, completion: (() -> Void)? = nil )Parameters
viewControllerUIViewController to navigate to
styleStyle of navigation (Default: nil)
-
Go to a viewController by using another viewController
Declaration
Swift
public func go( from: UIViewController, to: UIViewController, style: NavigationStyle, completion: (() -> Void)? = nil )Parameters
fromThe UIViewController that is handling the navigation
viewControllerUIViewController to navigate to
styleStyle of navigation (Default: nil)
-
Navigate back and dismiss the visibleViewController
Declaration
Swift
public func back(toRoot: Bool = false)Parameters
toRootShould navigate back to the rootViewController (Default: false)
-
Dismiss the visibleViewController
Declaration
Swift
public func dismiss()
-
Show an Alert
Declaration
Swift
public func alert( title: String, message: String, withActions actions: [UIAlertAction] = [], secondsToPersist: Double?, _ closure: ((UIAlertController) -> Void)? = nil )Parameters
titleTitle of the UIAlertController
messageMessage of the UIAlertController
withactionsArray of action objects to be added to the Alert (Default: [])
secondsToPersistAmount of seconds the Alert should show before dismissing itself
closureA closure that is passed the UIAlertController before presenting it (Default: nil)
-
Show an ActionSheet
Declaration
Swift
public func actionSheet( title: String, message: String, withActions actions: [UIAlertAction] = [], _ closure: ((UIAlertController) -> Void)? = nil )Parameters
titleTitle of the UIAlertController
messageMessage of the UIAlertController
withactionsArray of action objects to be added to the ActionSheet (Default: [])
closureA closure that is passed the UIAlertController before presenting it (Default: nil)
-
toast(style:pinToTop: secondsToPersist: animationInDuration: animationOutDuration: padding: tapHandler: _: ) Show a Toast Message
Declaration
Swift
@available(iOS 11.0, *) public func toast( style: ToastStyle = .custom, pinToTop: Bool = true, secondsToPersist: Double? = nil, animationInDuration: Double = 0.5, animationOutDuration: Double = 0.5, padding: Float = 8, tapHandler: @escaping (UIView) -> Void = { $0.removeFromSuperview() }, _ closure: @escaping () -> UIView )Parameters
styleThe ToastStyle (Default: .custom)
pinToTopShould the Toast pin to the top or bottom (Default: true)
secondsToPersistAmount of seconds the Toast should show before dismissing itself (Default: nil)
animationInDurationThe amount of seconds the Toast should fade in (Default: 0.5)
animationOutDurationThe amount of seconds the Toast should fade out (Default: 0.5)
paddingThe amount of spacing around the Toast (Default: 8)
tapHandlerWhat happens when the user taps on the Toast (Default: { $0.removeFromSuperview() })
closureA trailing closure that accepts a view
-
Destory the toast
Declaration
Swift
public func destroyToast()
View on GitHub
Navigate Class Reference