Skip to content

Repository files navigation

WallpaperCollections

一个从 GitHub 仓库读取并浏览壁纸的 SwiftUI iOS App,App 显示名称为 Oura

文档

当前能力

  • 优先读取静态 manifest,旧仓库自动回退到 GitHub Tree API;
  • 首页、搜索页共享同一份图片目录;
  • 网格优先使用预生成缩略图,详情页使用原图;
  • Kingfisher 下采样、内存缓存与磁盘缓存;
  • 使用 manifest 中的真实宽高比,并使用自适应 Masonry Grid 排列;
  • 支持按壁纸名称、分类和作者搜索;
  • 支持下拉刷新、加载中、空列表和网络错误状态;
  • 支持请求相册权限并将图片保存到系统相册;
  • 支持 SwiftData 收藏夹和独立的 Favorites 页面。

最近一次成功的壁纸索引会保存到 Application Support,启动时可以先显示旧数据再后台刷新。图片本体是否能离线显示取决于 Kingfisher 磁盘缓存是否仍然存在。

技术栈

  • SwiftUI
  • Swift Concurrency
  • Kingfisher 8.8.0
  • GitHub REST API

运行时配置

配置 当前值
App 显示名称 Oura
最低系统版本 iOS 18.6
GitHub owner/repository TheRealMilesLee / The-Wallpaper-Collection
branch master
manifest URL https://raw.githubusercontent.com/TheRealMilesLee/The-Wallpaper-Collection/master/manifest.json
首页默认路径 2026 Wallpaper
缩略图目录 thumbnails
Kingfisher 内存缓存 100 MB
Kingfisher 磁盘缓存 1 GB,7 天过期

开始使用

git clone https://github.com/MilesCorporate/iOS-WallpaperCollections.git
cd iOS-WallpaperCollections
open WallpaperCollections.xcodeproj

项目通过 Swift Package Manager 获取 Kingfisher。壁纸数据源当前配置在 WallpaperCollections/Controller/Service.swift 中。

生成壁纸 manifest

manifest 生成器位于 scripts/generate_wallpaper_manifest.py。它应该在壁纸源仓库的本地 checkout 上运行,并把生成的 manifest.jsonthumbnails/ 一起提交到源仓库:

python3 -m pip install pillow
python3 scripts/generate_wallpaper_manifest.py \
  --source /path/to/The-Wallpaper-Collection \
  --base-url https://raw.githubusercontent.com/TheRealMilesLee/The-Wallpaper-Collection/master

App 会从以下地址读取 manifest;如果文件不存在,会自动回退到 Tree API:

https://raw.githubusercontent.com/TheRealMilesLee/The-Wallpaper-Collection/master/manifest.json

manifest 中的 thumbnailUrlwidthheight 让列表页避免下载原图,并消除首次布局时的比例跳动。

完整的目录约定、字段说明、发布验证和回滚流程见 docs/MANIFEST.md

后续计划

  • 将 manifest 生成器接入壁纸源仓库 CI,自动发布 manifest 和缩略图;
  • 为 Tree API fallback 增加 ETag 和更细粒度的重试策略;
  • 增加收藏删除、批量管理和缓存清理入口;
  • 增加 Service、搜索和 ViewModel 测试;
  • 完成可访问性、字符串本地化和真正的收藏离线存储。

作者

Miles (Hengyi Li)

About

The brand new iOS app for my The-Wallpaper-Collections repository

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages