Popovers 开源项目使用教程

Popovers 开源项目使用教程

PopoversA library to present popovers. Simple, modern, and highly customizable. Not boring!项目地址:https://gitcode.com/gh_mirrors/po/Popovers

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

Popovers/
├── Example/
│   ├── PopoversExample/
│   │   ├── Assets.xcassets/
│   │   ├── Base.lproj/
│   │   ├── Info.plist
│   │   ├── AppDelegate.swift
│   │   ├── SceneDelegate.swift
│   │   ├── ViewController.swift
│   │   └── Main.storyboard
│   └── PopoversExample.xcodeproj
├── Package.swift
├── README.md
├── Sources/
│   └── Popovers/
│       ├── Popover.swift
│       ├── PopoverController.swift
│       └── PopoverOptions.swift
└── Tests/
    └── PopoversTests/
        └── PopoverTests.swift

目录结构介绍

  • Example/: 包含项目的示例应用程序。
    • PopoversExample/: 示例应用程序的主要目录。
      • Assets.xcassets/: 存放应用程序的资源文件,如图片等。
      • Base.lproj/: 存放应用程序的本地化资源。
      • Info.plist: 应用程序的配置文件。
      • AppDelegate.swift: 应用程序的入口文件。
      • SceneDelegate.swift: 应用程序的场景代理文件。
      • ViewController.swift: 示例应用程序的主视图控制器。
      • Main.storyboard: 应用程序的主界面布局文件。
    • PopoversExample.xcodeproj: Xcode 项目文件。
  • Package.swift: Swift 包管理文件。
  • README.md: 项目说明文档。
  • Sources/: 项目的源代码目录。
    • Popovers/: 项目的主要源代码目录。
      • Popover.swift: 弹出视图的主要实现文件。
      • PopoverController.swift: 弹出视图控制器的实现文件。
      • PopoverOptions.swift: 弹出视图的配置选项文件。
  • Tests/: 项目的测试代码目录。
    • PopoversTests/: 测试代码的主要目录。
      • PopoverTests.swift: 弹出视图的测试文件。

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)

PopoversA library to present popovers. Simple, modern, and highly customizable. Not boring!项目地址:https://gitcode.com/gh_mirrors/po/Popovers

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

俞毓滢

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

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

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

打赏作者

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

抵扣说明:

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

余额充值