NotificationView 开源项目教程

NotificationView 开源项目教程

NotificationViewiOS Basic Notification screens 🤚项目地址:https://gitcode.com/gh_mirrors/no/NotificationView

1. 项目的目录结构及介绍

NotificationView/
├── NotificationView/
│   ├── NotificationView.swift
│   ├── NotificationViewDelegate.swift
│   ├── NotificationViewTheme.swift
│   ├── NotificationViewConfig.swift
│   └── Resources/
│       ├── Images.xcassets
│       └── Fonts/
├── Example/
│   ├── Example/
│   │   ├── AppDelegate.swift
│   │   ├── SceneDelegate.swift
│   │   ├── ViewController.swift
│   │   └── Main.storyboard
│   └── ExampleTests/
│       └── ExampleTests.swift
├── NotificationView.xcodeproj
└── README.md

目录结构介绍

  • NotificationView/: 核心代码目录,包含 NotificationView 的主要实现文件。
    • NotificationView.swift: NotificationView 的主类文件。
    • NotificationViewDelegate.swift: NotificationView 的代理协议文件。
    • NotificationViewTheme.swift: NotificationView 的主题配置文件。
    • NotificationViewConfig.swift: NotificationView 的配置文件。
    • Resources/: 资源文件目录,包含图片和字体资源。
  • Example/: 示例项目目录,展示如何使用 NotificationView。
    • Example/: 示例项目的主要代码和界面文件。
    • ExampleTests/: 示例项目的测试文件。
  • NotificationView.xcodeproj: Xcode 项目文件。
  • README.md: 项目说明文档。

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 AppDelegate methods...
}

SceneDelegate.swift

import UIKit

@available(iOS 13.0, *)
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 }
    }

    // Other SceneDelegate methods...
}

3. 项目的配置文件介绍

NotificationViewConfig.swift

import UIKit

struct NotificationViewConfig {
    static let defaultHideDuration: TimeInterval = 3.0
    static let defaultBackgroundColor: UIColor = .white
    static let defaultTextColor: UIColor = .black
    static let defaultFont: UIFont = .systemFont(ofSize: 16)
}

NotificationViewTheme.swift

import UIKit

enum NotificationViewTheme {
    case light
    case dark
    case custom(backgroundColor: UIColor, textColor: UIColor, font: UIFont)
}

以上是 NotificationView 开源项目的目录结构、启动文件和配置文件的介绍。希望这份教程能帮助你更好地理解和使用该项目。

NotificationViewiOS Basic Notification screens 🤚项目地址:https://gitcode.com/gh_mirrors/no/NotificationView

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

滑芯桢

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值