# AppDelegate
**Repository Path**: CaamDau/AppDelegate
## Basic Information
- **Project Name**: AppDelegate
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-06-16
- **Last Updated**: 2022-01-17
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
[](https://travis-ci.org/CaamDau/AppDelegate)
[](https://cocoapods.org/pods/CaamDauAppDelegate)
[](https://cocoapods.org/pods/CaamDauAppDelegate)
[](https://cocoapods.org/pods/CaamDauAppDelegate)
[](https://cocoapods.org/pods/CaamDauAppDelegate)
# AppDelegate
> AppDelegate 解耦
## Installation
CaamDau is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod 'CaamDauAppDelegate'
pod 'CaamDau/AppDelegate'
```
### AppDelegate
```
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
lazy var composite: AppComposite = {
return AppComposite([
AppConfig(),
AppWindow(window),
AppUM(),
AppPay()
])
}()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return composite.application(application, didFinishLaunchingWithOptions:launchOptions)
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return composite.application(app, open: url, options: options)
}
}
```
### AppDelegate Modul
```
class AppWindow: AppProtocol {
var window: UIWindow?
init(_ win: UIWindow?) {
window = win
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
let vc = VC_Tab.show()
window?.rootViewController = vc
window?.makeKeyAndVisible()
return true
}
}
```
```
class AppConfig: AppProtocol {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return true
}
}
```
```
class AppPay: AppProtocol {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return true
}
}
```
## Author
liucaide, 565726319@qq.com
## License
CaamDau is available under the MIT license. See the LICENSE file for more info.