设置初始视图控制器

我想设置 appcommittee 的初始 viewcontroller。我找到了一个非常好的答案,不过是在目标 C 中,我在快速实现同样的目标方面遇到了麻烦。

使用情节串连板以编程方式设置初始视图控制器

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];


UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];


UIViewController *viewController = // determine the initial view controller here and instantiate   it with [storyboard instantiateViewControllerWithIdentifier:<storyboard id>];


self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];


return YES;
}

有人能帮忙吗?

我希望最初的 Viewcontroller 依赖于使用 If判断语句所满足的某些条件。

222373 次浏览

试试这个,例如: 您应该使用 UINavigationController作为初始视图控制器。然后,您可以将任何视图控制器设置为来自故事板的根。

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let navigationController = storyboard.instantiateInitialViewController() as UINavigationController
let rootViewController = storyboard.instantiateViewControllerWithIdentifier("VC") as UIViewController
navigationController.viewControllers = [rootViewController]
self.window?.rootViewController = navigationController
return true
}

参见 我的故事板屏幕。

如果你不使用故事板,你可以试试这个

var window: UIWindow?
var initialViewController :UIViewController?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {


initialViewController  = MainViewController(nibName:"MainViewController",bundle:nil)


let frame = UIScreen.mainScreen().bounds
window = UIWindow(frame: frame)


window!.rootViewController = initialViewController
window!.makeKeyAndVisible()


return true
}

Xcode11和 Scene 委托说明:

从 Xcode11开始,因为场景委托,很可能您不应该在 AppDelegate中执行此操作。而是从 SceneDelegate开始。有关这方面的更多信息,请参见 另一个答案


老答案:

我使用这个线程来帮助我将目标 C 转换为快速,并且它工作得很完美。

在 Swift 中实例化并呈现一个 viewController

Swift 2 代码:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
    

let storyboard = UIStoryboard(name: "Main", bundle: nil)
    

let initialViewController = storyboard.instantiateViewControllerWithIdentifier("LoginSignupVC")
    

self.window?.rootViewController = initialViewController
self.window?.makeKeyAndVisible()
    

return true
}

Swift 3 代码:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
self.window = UIWindow(frame: UIScreen.main.bounds)


let storyboard = UIStoryboard(name: "Main", bundle: nil)
    

let initialViewController = storyboard.instantiateViewController(withIdentifier: "LoginSignupVC")


self.window?.rootViewController = initialViewController
self.window?.makeKeyAndVisible()


return true
}

我是在 Objective-C 中完成的,希望对您有用。

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];


UIViewController *viewController;


NSUserDefaults *loginUserDefaults = [NSUserDefaults standardUserDefaults];
NSString *check=[loginUserDefaults objectForKey:@"Checklog"];


if ([check isEqualToString:@"login"]) {
    

viewController = [storyboard instantiateViewControllerWithIdentifier:@"SWRevealViewController"];
} else {
    

viewController = [storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
}




self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];
I worked out a solution on Xcode 6.4 in swift.


// I saved the credentials on a click event to phone memory


@IBAction func gotobidderpage(sender: AnyObject) {
if (usernamestring == "bidder" && passwordstring == "day303")
{
rolltype = "1"


NSUserDefaults.standardUserDefaults().setObject(usernamestring, forKey: "username")
NSUserDefaults.standardUserDefaults().setObject(passwordstring, forKey: "password")
NSUserDefaults.standardUserDefaults().setObject(rolltype, forKey: "roll")




self.performSegueWithIdentifier("seguetobidderpage", sender: self)
}




// Retained saved credentials in app delegate.swift and performed navigation after condition check




func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {


let usernamestring = NSUserDefaults.standardUserDefaults().stringForKey("username")
let passwordstring = NSUserDefaults.standardUserDefaults().stringForKey("password")
let rolltypestring = NSUserDefaults.standardUserDefaults().stringForKey("roll")


if (usernamestring == "bidder" && passwordstring == "day303" && rolltypestring == "1")
{


// Access the storyboard and fetch an instance of the view controller
var storyboard = UIStoryboard(name: "Main", bundle: nil)
var viewController: BidderPage = storyboard.instantiateViewControllerWithIdentifier("bidderpageID") as! BidderPage


// Then push that view controller onto the navigation stack
var rootViewController = self.window!.rootViewController as! UINavigationController
rootViewController.pushViewController(viewController, animated: true)
}


// Override point for customization after application launch.
return true
}






Hope it helps !

这是一个接近它的好方法。这个示例将一个导航控制器放置为根视图控制器,并将您选择的视图控制器放置在导航堆栈的底部,以便您可以从中推出需要的任何内容。

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{
// mainStoryboard
let mainStoryboard = UIStoryboard(name: "MainStoryboard", bundle: nil)


// rootViewController
let rootViewController = mainStoryboard.instantiateViewControllerWithIdentifier("MainViewController") as? UIViewController


// navigationController
let navigationController = UINavigationController(rootViewController: rootViewController!)


navigationController.navigationBarHidden = true // or not, your choice.


// self.window
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)


self.window!.rootViewController = navigationController


self.window!.makeKeyAndVisible()
}

为了使这个示例工作,您需要在主视图控制器上将“ MainViewController”设置为 Storyboard ID,在这个示例中,Storyboard 的文件名为“ MainStoryboard.Storyboard”。我以这种方式重命名我的故事板,因为 Main.Storyboard 对我来说不是一个合适的名字,特别是如果你曾经去子类化它的话。

如果你想在视图控制器中而不是在应用程序代理中做这件事: 只需要在视图控制器中获取对应用程序代理的引用,然后用右边的视图控制器重置它的窗口对象,就像它的 rootviewController 一样。

let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
appDelegate.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let yourVC = mainStoryboard.instantiateViewControllerWithIdentifier("YOUR_VC_IDENTIFIER") as! YourViewController
appDelegate.window?.rootViewController = yourVC
appDelegate.window?.makeKeyAndVisible()

以上/以下所有的答案都是关于故事板中没有切入点的警告。

如果您希望有2个(或更多)依赖于某些条件(比如 条件变数)的条目视图控制器,那么您应该做的是:

  • 在 Main.storboard 中创建 UINavigationController 没有 rootViewController,将其设置为入口点
  • 在视图控制器中创建2个(或更多)“ Show”界面,分配给它们一些 id,比如 表1表格 ID2
  • 使用下一个代码:

    class AppDelegate: UIResponder, UIApplicationDelegate {
    
    
    var window: UIWindow?
    
    
    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    let navigationController = window!.rootViewController! as! UINavigationController
    navigationController.performSegueWithIdentifier(conditionVariable ? "id1" : "id2")
    
    
    return true
    }
    

Hope this helps.

我已经在 Xcode 8和 swift 3.0中做了,希望它对你有用,而且它工作得很完美。使用以下代码:

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
self.window = UIWindow(frame: UIScreen.main.bounds)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewController = storyboard.instantiateViewController(withIdentifier: "ViewController")
self.window?.rootViewController = initialViewController
self.window?.makeKeyAndVisible()
return true
}

如果你正在使用导航控制器,请使用以下代码:

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
self.window = UIWindow(frame: UIScreen.main.bounds)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let navigationController:UINavigationController = storyboard.instantiateInitialViewController() as! UINavigationController
let initialViewController = storyboard.instantiateViewControllerWithIdentifier("ViewController")
navigationController.viewControllers = [initialViewController]
self.window?.rootViewController = navigationController
self.window?.makeKeyAndVisible()
return true
}

斯威夫特3、斯威夫特4:

将第一行更改为

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool

剩下的都一样。

Swift 5 + :

从故事板实例化 root 视图控制器:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// this line is important
self.window = UIWindow(frame: UIScreen.main.bounds)


// In project directory storyboard looks like Main.storyboard,
// you should use only part before ".storyboard" as its name,
// so in this example name is "Main".
let storyboard = UIStoryboard.init(name: "Main", bundle: nil)
        

// controller identifier sets up in storyboard utilities
// panel (on the right), it is called 'Storyboard ID'
let viewController = storyboard.instantiateViewController(withIdentifier: "YourViewControllerIdentifier") as! YourViewController


self.window?.rootViewController = viewController
self.window?.makeKeyAndVisible()
return true
}

如果您想使用 UINavigationController作为 root 用户:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// this line is important
self.window = UIWindow(frame: UIScreen.main.bounds)


let storyboard = UIStoryboard.init(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "YourViewControllerIdentifier") as! YourViewController
let navigationController = UINavigationController.init(rootViewController: viewController)
self.window?.rootViewController = navigationController


self.window?.makeKeyAndVisible()
return true
}

从 xib 实例化 root 视图控制器:

几乎是一样的,只是没有线条

let storyboard = UIStoryboard.init(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "YourViewControllerIdentifier") as! YourViewController

你得写信

let viewController = YourViewController(nibName: "YourViewController", bundle: nil)

斯威夫特4:

将这些代码行添加到 AppRegiate.swift 中,在 did FinishLaunchingWithOptions ()函数中..。

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {


// Setting the Appropriate initialViewController


// Set the window to the dimensions of the device
self.window = UIWindow(frame: UIScreen.main.bounds)


// Grab a reference to whichever storyboard you have the ViewController within
let storyboard = UIStoryboard(name: "Name of Storyboard", bundle: nil)


// Grab a reference to the ViewController you want to show 1st.
let initialViewController = storyboard.instantiateViewController(withIdentifier: "Name of ViewController")


// Set that ViewController as the rootViewController
self.window?.rootViewController = initialViewController


// Sets our window up in front
self.window?.makeKeyAndVisible()


return true
}

现在,举例来说,当我们想要将用户驱动到一个登录屏幕或者一个初始设置屏幕或者返回到应用程序的 mainScreen 等时,很多时候我们都会做类似的事情。如果你也想做类似的事情,你可以用这一点作为一个分岔路口。

例如,您可以在 NSUserDefault 中存储一个包含 userLoggedIn Boolean 和 if userLoggedIn == false { use this storyboard & initialViewController... } else { use this storyboard & initialViewController... }的值

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {


self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
var exampleViewController: ExampleViewController = mainStoryboard.instantiateViewControllerWithIdentifier("ExampleController") as! ExampleViewController


self.window?.rootViewController = exampleViewController


self.window?.makeKeyAndVisible()


return true
}

以下是 Swift 4中的完整解决方案 在 did FinishLaunchingWithOptions 中实现这一点

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {


let isLogin = UserDefaults.standard.bool(forKey: "Islogin")
if isLogin{
self.NextViewController(storybordid: "OtherViewController")




}else{
self.NextViewController(storybordid: "LoginViewController")


}
}

把这个函数写在应用程序的任何地方

  func NextViewController(storybordid:String)
{


let storyBoard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let exampleVC = storyBoard.instantiateViewController(withIdentifier:storybordid )
// self.present(exampleVC, animated: true)
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = exampleVC
self.window?.makeKeyAndVisible()
}

对于 Swift 4.0

没有完成启动方法中的 应用代理,迅捷文件中,放置以下代码。

var window: UIWindow?




func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.makeKeyAndVisible()


let rootVC = MainViewController() // your custom viewController. You can instantiate using nib too. UIViewController(nib name, bundle)
//let rootVC = UIViewController(nibName: "MainViewController", bundle: nil) //or MainViewController()
let navController = UINavigationController(rootViewController: rootVC) // Integrate navigation controller programmatically if you want


window?.rootViewController = navController


return true
}

希望一切顺利。

如果你没有使用情节串连图板。你可以通过编程的方式初始化你的主视图控制器。

Swift 4

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {


let rootViewController = MainViewController()
let navigationController = UINavigationController(rootViewController: rootViewController)
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = navigationController
self.window?.makeKeyAndVisible()


return true
}
class MainViewController: UIViewController {


override func viewDidLoad() {
super.viewDidLoad()


view.backgroundColor = .green
}
}

同时从 部署信息中移除 Main

enter image description here

Swift 4.2和5代码:

var window: UIWindow?




func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
self.window = UIWindow(frame: UIScreen.main.bounds)


let storyboard = UIStoryboard(name: "Main", bundle: nil)


let initialViewController = storyboard.instantiateViewController(withIdentifier: "dashboardVC")


self.window?.rootViewController = initialViewController
self.window?.makeKeyAndVisible()
}

对于 Xcode 11+ and for Swift 5+:

class SceneDelegate: UIResponder, UIWindowSceneDelegate {


var window: UIWindow?


func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)


window.rootViewController = // Your RootViewController in here


self.window = window
window.makeKeyAndVisible()
}
}
}

使用 SWReveaViewController From App 委托打开 viewcontroller。

 self.window = UIWindow(frame: UIScreen.main.bounds)
let storyboard = UIStoryboard(name: "StoryboardName", bundle: nil)
let swrevealviewcontroller:SWRevealViewController = storyboard.instantiateInitialViewController() as! SWRevealViewController
self.window?.rootViewController = swrevealviewcontroller
self.window?.makeKeyAndVisible()

对于新的 Xcode 11.xxx 和 Swift 5. xx,目标设置为 iOS 13 + 。

对于新的项目结构,AppDepate 不必做任何关于 rootViewController 的事情。

一个新的类用于处理窗口(UIWindowScene) class-> ‘ SceneGenerate’文件。

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?


func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {


if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = // Your RootViewController in here
self.window = window
window.makeKeyAndVisible()
}


}

Swift 5 & Xcode 11

因此,在 xCode 11中,窗口解决方案在 appDelegate 内部不再有效。他们把这个移到了场景门。您可以在 SceneDelgate.swift 文件中找到它。

你会注意到它现在有一个 var window: UIWindow?的礼物。

在我的情况下,我使用的是来自故事板的 TabBarController,并希望将其设置为 rootViewController。

这是我的暗号:

场景授权,迅速

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).


self.window = self.window ?? UIWindow()//@JA- If this scene's self.window is nil then set a new UIWindow object to it.


//@Grab the storyboard and ensure that the tab bar controller is reinstantiated with the details below.
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let tabBarController = storyboard.instantiateViewController(withIdentifier: "tabBarController") as! UITabBarController


for child in tabBarController.viewControllers ?? [] {
if let top = child as? StateControllerProtocol {
print("State Controller Passed To:")
print(child.title!)
top.setState(state: stateController)
}
}


self.window!.rootViewController = tabBarController //Set the rootViewController to our modified version with the StateController instances
self.window!.makeKeyAndVisible()


print("Finished scene setting code")
guard let _ = (scene as? UIWindowScene) else { return }
}

请确保添加到正确的场景方法,如我在这里所做的。注意,您需要为您在故事板中使用的 tabBarController 或 viewController 设置 标识符名称

how to set the storyboard ID

在我的例子中,我这样做是为了设置一个 stateController 来跟踪 tab 视图之间的共享变量。如果您希望执行同样的操作,请添加以下代码..。

州长 Swift

import Foundation


struct tdfvars{
var rbe:Double = 1.4
var t1half:Double = 1.5
var alphaBetaLate:Double = 3.0
var alphaBetaAcute:Double = 10.0
var totalDose:Double = 6000.00
var dosePerFraction:Double = 200.0
var numOfFractions:Double = 30
var totalTime:Double = 168
var ldrDose:Double = 8500.0
}


//@JA - Protocol that view controllers should have that defines that it should have a function to setState
protocol StateControllerProtocol {
func setState(state: StateController)
}


class StateController {
var tdfvariables:tdfvars = tdfvars()
}

注意: 只要使用您自己的变量或者您试图跟踪的任何变量,我只是将我的变量作为一个例子列在 tdf 变量结构中。

在 TabController 的每个视图中添加以下成员变量。

    class SettingsViewController: UIViewController {
var stateController: StateController?
.... }

然后在这些文件中添加以下内容:

extension SettingsViewController: StateControllerProtocol {
func setState(state: StateController) {
self.stateController = state
}
}

这样做的目的是 允许您避免单例方法在视图之间传递变量。这使得依赖注入模型的长期运行要比单例模型好得多。

应用委托中的 Init ViewController

[初始视图控制器]

关闭 Main.storyboard

General -> Deployment Info -> Main Interface -> remove `Main`
Info.plist -> remove Key/Value for `UISceneStoryboardFile` and `UIMainStoryboardFile`

添加故事板 ID

Main.storyboard -> Select View Controller -> Inspectors -> Identity inspector -> Storyboard ID -> e.g. customVCStoryboardId

前情提要
Swift 5和 Xcode 11

扩展 UIWindow

class CustomWindow : UIWindow {
//...
}

由 Xcode SceneDelegate.swift生成的编辑

class SceneDelegate: UIResponder, UIWindowSceneDelegate {


var window: CustomWindow!


func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        

guard let windowScene = (scene as? UIWindowScene) else { return }


let storyboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewController = storyboard.instantiateViewController(withIdentifier: "customVCStoryboardId")


//or if your storyboard has `Is Initial View Controller`
let storyboard = UIStoryboard(name: String(describing: SomeViewController.self), bundle: nil)
let initialViewController = storyboard.instantiateInitialViewController()


window = CustomWindow(windowScene: windowScene)
window.rootViewController = initialViewController
window.makeKeyAndVisible()
}


//...
}

[使用框架资料包]
[从框架获取故事板]

对于 Swift 5 +


var window: UIWindow?


func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
let submodules = (
home: HomeRouter.createModule(),
search: SearchRouter.createModule(),
exoplanets: ExoplanetsRouter.createModule()
)
            

let tabBarController = TabBarModuleBuilder.build(usingSubmodules: submodules)
            

window.rootViewController = tabBarController
self.window = window
window.makeKeyAndVisible()
}
}


IOS13 +

场景代理:

var window: UIWindow?


func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options
connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
let vc = UIViewController() //Instead of UIViewController() we initilise our initial viewController
window?.rootViewController = vc
window?.makeKeyAndVisible()
}

如果我的应用程序用户已经存在于密钥链或用户默认设置中,那么我发现这个答案很有帮助,并且在我需要更改 rootviewcontroller 的情况下非常有效。

Https://stackoverflow.com/a/58413582/6596443

Swift 5.3 + 和 iOS 13.0 +

将初始 ViewController 设置为“ 现场授权,迅速”//Only

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
    

var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
setInitialViewController()
window?.makeKeyAndVisible()
}
    

func setInitialViewController()  {
        

// Set Story board Controller
/*
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "ViewController")
*/
        

// Set Custom Xib
let vc = FrontVC(nibName: "FrontViewController", bundle: nil)
        

// Navigation Controller
let nav = UINavigationController(rootViewController: vc)
nav.isNavigationBarHidden = true
window?.rootViewController = nav
}