斗鱼直播仿制项目使用教程
DouYuLive仿斗鱼直播-Swift4.0,不断更新中。。。项目地址:https://gitcode.com/gh_mirrors/do/DouYuLive
1. 项目的目录结构及介绍
DouYuLive
├── DouYuLive.xcodeproj
├── DouYuLive.xcworkspace
├── DouYuLive
│ ├── AppDelegate.swift
│ ├── SceneDelegate.swift
│ ├── ViewController.swift
│ ├── Assets.xcassets
│ ├── Base.lproj
│ ├── Info.plist
│ └── ...
├── DouYuLiveTests
│ └── DouYuLiveTests.swift
├── DouYuLiveUITests
│ └── DouYuLiveUITests.swift
├── Pods
│ └── ...
├── images
│ └── ...
├── .DS_Store
├── .gitignore
├── LICENSE
├── Podfile
├── Podfile.lock
└── README.md
目录结构说明
- DouYuLive.xcodeproj: Xcode项目文件。
- DouYuLive.xcworkspace: Xcode工作区文件。
- DouYuLive: 主项目目录,包含应用的主要代码和资源。
- AppDelegate.swift: 应用的入口和生命周期管理。
- SceneDelegate.swift: 多窗口场景管理(适用于iOS 13及以上)。
- ViewController.swift: 主视图控制器。
- Assets.xcassets: 应用的资源文件,如图片、颜色等。
- Base.lproj: 本地化资源。
- Info.plist: 应用的配置信息。
- DouYuLiveTests: 单元测试目录。
- DouYuLiveUITests: UI测试目录。
- Pods: 通过CocoaPods管理的第三方库。
- images: 图片资源。
- .DS_Store: macOS系统文件,忽略即可。
- .gitignore: Git忽略文件配置。
- LICENSE: 项目许可证。
- Podfile: CocoaPods依赖管理文件。
- Podfile.lock: CocoaPods锁定文件。
- README.md: 项目说明文档。
2. 项目的启动文件介绍
AppDelegate.swift
import UIKit
@main
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
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
SceneDelegate.swift
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
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).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re
DouYuLive仿斗鱼直播-Swift4.0,不断更新中。。。项目地址:https://gitcode.com/gh_mirrors/do/DouYuLive