Blackbird 是一个简洁、高效的 iOS RSS 阅读器应用,使用 SwiftUI 和 SwiftData 构建。它允许用户添加、管理和阅读来自各种网站的 RSS/Atom/JSON Feed 订阅源。
brew install xcodegen)克隆仓库:
git clone https://github.com/deadjoe/blackbird.git
cd blackbird
生成 Xcode 项目:
xcodegen
打开生成的 Xcode 项目:
open Blackbird.xcodeproj
构建并运行应用
你可以使用以下命令在模拟器中运行应用:
# 列出可用的模拟器
xcrun simctl list devices available
# 启动模拟器(以 iPhone 15 Pro Max 为例)
xcrun simctl boot "iPhone 15 Pro Max"
# 构建并安装应用到模拟器
xcodebuild -project Blackbird.xcodeproj -scheme Blackbird -destination "platform=iOS Simulator,name=iPhone 15 Pro Max" build
# 在模拟器中启动应用
xcrun simctl launch booted com.deadjoe.blackbird
Blackbird/
├── BlackbirdApp.swift # 应用入口点
├── Models/ # 数据模型(Feed、Article、FeedCategory)
├── Views/ # SwiftUI 视图
│ ├── FeedListView # Feed 列表视图
│ ├── ArticleListView # 文章列表视图
│ ├── ArticleDetailView # 文章详情视图
│ ├── StarredArticlesView # 收藏文章视图
│ └── Components/ # 可复用组件
├── ViewModels/ # 视图模型
│ ├── FeedListViewModel # Feed 列表视图模型
│ ├── ArticleViewModel # 文章视图模型
│ └── CategoryViewModel # 分类视图模型
├── Services/ # 服务层
│ └── FeedService # Feed 服务(获取和解析 Feed)
├── Extensions/ # Swift 扩展
│ └── StringExtensions # 字符串处理扩展
└── Utils/ # 工具类
项目包含全面的单元测试,涵盖了核心功能、数据模型和视图模型。测试文件组织如下:
BlackbirdTests/
├── ModelTests.swift # 数据模型测试
├── ArticleViewModelTests.swift # 文章视图模型测试
├── CategoryViewModelTests.swift # 分类视图模型测试
├── FeedListViewModelTests.swift # Feed 列表视图模型测试
├── FeedServiceTests.swift # Feed 服务测试
├── StringExtensionsTests.swift # 字符串扩展测试
├── ArticleDetailViewTests.swift # 文章详情视图测试
├── ArticleListViewTests.swift # 文章列表视图测试
├── FeedListViewTests.swift # Feed 列表视图测试
└── StarredArticlesViewTests.swift # 收藏文章视图测试
使用 Xcode:
xcodegen
open Blackbird.xcodeproj
# 在 Xcode 中按 Cmd+U 运行测试
使用命令行:
xcodebuild test -project Blackbird.xcodeproj -scheme Blackbird -destination "platform=iOS Simulator,name=iPhone 15 Pro Max"
欢迎提交 Pull Request 和 Issue。请确保新代码有适当的测试覆盖率。
MIT