EhPanda 项目使用教程
1. 项目的目录结构及介绍
EhPanda 项目的目录结构如下:
EhPanda/
├── EhPanda/
│ ├── App/
│ ├── Core/
│ ├── Features/
│ ├── Resources/
│ ├── Utils/
│ └── AppDelegate.swift
├── ehpanda-website/
│ ├── public/
│ ├── src/
│ └── package.json
├── EhTagTranslation_Database_EN/
│ └── data/
├── EhTagTranslation_Database_JPN/
│ └── data/
└── README.md
目录介绍
-
EhPanda/: 主应用程序目录,包含应用程序的主要代码和资源。
- App/: 包含应用程序的主要逻辑和界面。
- Core/: 包含核心功能和模块。
- Features/: 包含应用程序的各个功能模块。
- Resources/: 包含应用程序的资源文件,如图片、本地化文件等。
- Utils/: 包含实用工具和辅助函数。
- AppDelegate.swift: 应用程序的启动文件。
-
ehpanda-website/: 项目网站的源代码目录。
- public/: 包含网站的静态资源。
- src/: 包含网站的源代码。
- package.json: 网站项目的配置文件。
-
EhTagTranslation_Database_EN/ 和 EhTagTranslation_Database_JPN/: 包含标签翻译的数据库文件。
- data/: 包含翻译数据文件。
2. 项目的启动文件介绍
EhPanda 项目的启动文件是 AppDelegate.swift
,位于 EhPanda/AppDelegate.swift
。该文件负责应用程序的初始化和生命周期管理。
import SwiftUI
@main
struct EhPandaApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// 初始化代码
return true
}
}
启动文件功能
- @main: 标记应用程序的入口点。
- AppDelegate: 负责应用程序的生命周期事件,如启动、进入后台、恢复等。
3. 项目的配置文件介绍
EhPanda 项目的配置文件主要包括 package.json
和 Info.plist
。
package.json
package.json
文件位于 ehpanda-website/package.json
,用于配置网站项目的依赖和脚本。
{
"name": "ehpanda-website",
"version": "1.0.0",
"description": "The source code for https://ehpanda.app",
"main": "src/index.js",
"scripts": {
"start": "node src/index.js"
},
"dependencies": {
"express": "^4.17.1"
}
}
Info.plist
Info.plist
文件通常位于 EhPanda/Info.plist
,用于配置应用程序的元数据和行为。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>EhPanda</string>
<key>CFBundleIdentifier</key>
<string>com.ehpanda.app</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait