在 Xcode 中创建应用程序时的入口点(应用程序级别)是什么?

What is the entry point (app level) when creating an app in Xcode?

我正在创建一个 iOS 应用程序,用于在 sqlite 数据库(迷你项目)中存储联系电话。从功能的角度来看,它工作得很好,但我并没有真正遵循 MVC 模式。我在根 viewcontroller 的 viewDidLoad() 函数中创建了 table,但我的上司说这不是一个好的做法。他说我要"put the create the table part in the app level or the entry point of the app"。我不知道那是哪里。

通常,您会希望将应用程序的初始化代码放在 AppDelegate class 的 application(_:didFinishLaunchingWithOptions:) 方法中。此 class 在 AppDelegate.swift 文件中定义,该文件默认在每个 iOS 项目中创建。如果你从来没有碰过它,它看起来像这样:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    return true
}

我想这就是你的上司在说入口点时的意思。