Keyboardy 开源项目使用教程
KeyboardyUIViewController extension for convenient keyboard management.项目地址:https://gitcode.com/gh_mirrors/ke/Keyboardy
1. 项目的目录结构及介绍
Keyboardy/
├── Keyboardy/
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ ├── Base.lproj
│ ├── Info.plist
│ ├── KeyboardViewController.swift
│ ├── SceneDelegate.swift
│ └── ViewController.swift
├── Keyboardy.xcodeproj
│ ├── project.pbxproj
│ └── xcshareddata
├── KeyboardyKeyboard/
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ ├── Base.lproj
│ ├── Info.plist
│ ├── KeyboardViewController.swift
│ ├── SceneDelegate.swift
│ └── ViewController.swift
├── KeyboardyKeyboard.xcodeproj
│ ├── project.pbxproj
│ └── xcshareddata
├── README.md
└── LICENSE
目录结构说明
Keyboardy/
: 主应用的源代码目录。
AppDelegate.swift
: 应用的入口文件。Assets.xcassets
: 应用的资源文件,包括图片等。Base.lproj
: 本地化资源文件。Info.plist
: 应用的配置文件。KeyboardViewController.swift
: 键盘视图控制器。SceneDelegate.swift
: 场景代理文件。ViewController.swift
: 主视图控制器。
Keyboardy.xcodeproj
: Xcode 项目文件。KeyboardyKeyboard/
: 键盘扩展的源代码目录。KeyboardyKeyboard.xcodeproj
: 键盘扩展的 Xcode 项目文件。README.md
: 项目说明文档。LICENSE
: 项目许可证文件。
2. 项目的启动文件介绍
主应用启动文件
AppDelegate.swift
: 这是主应用的入口文件,负责应用的生命周期管理。
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// Other lifecycle methods...
}
键盘扩展启动文件
KeyboardViewController.swift
: 这是键盘扩展的入口文件,负责键盘的显示和交互。
import UIKit
class KeyboardViewController: UIInputViewController {
override func updateViewConstraints() {
super.updateViewConstraints()
// Add custom view configuration here
}
override func viewDidLoad() {
super.viewDidLoad()
// Perform custom UI setup here
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Customize the keyboard appearance
}
// Other keyboard methods...
}
3. 项目的配置文件介绍
主应用配置文件
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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Keyboardy</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</
KeyboardyUIViewController extension for convenient keyboard management.项目地址:https://gitcode.com/gh_mirrors/ke/Keyboardy