SkillAgentSearch skills...

EmptyPage

An empty state control to give visually appealing context when building iOS applications.

Install / Use

/learn @linhay/EmptyPage
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

title

演示:

| 0 | 1 | 2 | | :---------------------------------------------: | :---------------------: | :---------------------: | | UICollectionView | UITableView | 多状态切换 |

预置模板视图:

| | | | | | | :--: | :--: | :--: | :--: | :--: | | 静态图 | 动图 | 纯文本 | 富文本 | 复合型视图 |

特点:

  • [x] 提供默认管理器来支持 UICollectionView & UITableView.
  • [x] 可以自定义管理器来支持任何视图.
  • [x] 空白页可以是任何形式的视图
  • [x] 可以设置自定义的管理器来替代默认管理器
  • [x] 可以设置自定义的管理器来全局替代默认管理器
  • [x] 我们预置了几套模板来便捷的构建空页面.
  • [x] 我们预置了一套带状态的管理器来应对无网络或更多情况

使用

  1. 下面是一个简单的示例, 用来将一个空白页绑定在UICollectionView上:
    let customEmptyView = CustomEmptyView()
    collectionView.ep.set(emptyView: customEmptyView)
    

    空白页将在 UICollectionView 执行 reloadData()之后, 并判断数据源为空的情况下, 正确的出现在 UICollectionView 上.

  2. 使用预置模板快速创建空白页视图:
    <table style="margin-left: auto; margin-right: auto;"> <tr> <td> <!--左侧内容--> <img src="https://github.com/linhay/EmptyPage/assets/15262434/61a8ed38-8bce-424d-9901-9174bef8d02f" style="zoom:100%;" /> </td> <td> <!--右侧内容--> <img src="https://github.com/linhay/EmptyPage/assets/15262434/f47e0e81-c5fd-4cee-909d-830b892a9106" style="zoom:100%;" /> </td> </tr> </table>

安装

CocoaPods

  1. 全量安装

    pod 'EmptyPage'
    
  2. 按需安装

    pod 'EmptyPage/core'      # 核心库
    pod 'EmptyPage/managers'  # 拓展的管理器, 带状态的管理器就在其中
    pod 'EmptyPage/templates' # 预置的空白页模板
    

Swift Package Manager

Swift Package Manager 是一个管理 Swift 代码分发的工具。它与 Swift 构建系统集成在一起,使下载、编译和链接依赖关系的过程自动化。

使用 Xcode 11.0 + 进入你的项目文件并输入这个存储库的项目 URL:

https://github.com/linhay/EmptyPage

更多

我们准备了一个 wiki 页面,可以在那里找到很多有用的示例与用法。

限制

  • iOS 9.0+
  • Swift 4.0+
  • XCode 11.0+

联系

关注我并在Twitter或者微博上联系我。如果你发现一个问题,只要创建 issues, 我们也期望你使用pull-requests来参与项目中来。

许可证

EmptyPage 是在 Apache License 2.0 许可下发布的。详细信息请参阅 LICENSE

View on GitHub
GitHub Stars91
CategoryDevelopment
Updated8mo ago
Forks12

Languages

HTML

Security Score

92/100

Audited on Jul 30, 2025

No findings