基于 SwiftUI 打造的水木社区多端客户端(iOS / iPadOS / macOS)。采用 MVVM + Repository 架构,支持依赖注入、分页加载和多平台适配。 项目详细介绍可以查看我的博客文章 Smth 客户端开发:从 MVVM 架构到多平台适配的 SwiftUI 实践
- ✅ 热门话题浏览 - 瀑布流展示,支持分页加载
- ✅ 版面导航 - 层级式版面/子版面导航
- ✅ 话题详情 - 完整的话题内容与楼层回复展示
- ✅ 图片查看器 - 支持多图片滑动浏览、缩放、双击放大(iOS 基于 UIKit,macOS 基于 SwiftUI)
- ✅ 用户登录 - 基于 WebView 的登录认证
- ✅ 收藏管理 - 收藏版面与话题,支持分类查看
- ✅ 消息中心 - 收件箱、@我的、回复我的、Like我的
- ✅ 个人中心 - 个人资料、我的话题、草稿、关注/粉丝、浏览历史
- ✅ 搜索功能 - 版面与话题搜索
- 🎨 现代化 UI - 统一的主题系统,支持深色模式
- 📱 多平台适配 - iOS、iPadOS、macOS 原生体验
- 🔄 响应式布局 - 自适应不同屏幕尺寸
- ⚡ 流畅交互 - 优化的加载状态与错误处理
- 💾 本地缓存 - 浏览历史与草稿本地存储
采用 MVVM + Repository 架构模式:
View (SwiftUI) → ViewModel → Repository → APIService
- Core: 认证、数据库、依赖注入、网络层、工具类
- Modules: 首页、收藏、消息、个人中心、搜索(MVVM 结构)
- Components: 可复用 UI 组件(包括图片查看器)
- Model: 数据模型和 DTO
- iOS: TabView 底部导航
- iPadOS: NavigationSplitView 侧边栏布局
- macOS: NavigationSplitView 侧边栏 + 内容区
| 首页 | 收藏 | 消息 |
|---|---|---|
![]() |
![]() |
![]() |
| 个人中心 | 设置 | 登录 |
|---|---|---|
![]() |
![]() |
![]() |
- 热门话题列表(瀑布流)
- 版面选择器
- 话题详情页
- 文章回复展示
- 图片附件展示
- 下拉刷新
- 收藏版面列表
- 收藏话题列表
- 版面/话题切换
- 版面层级导航
- 收件箱、@我的、回复我的、Like我的
- 会话详情
- 消息分页加载
- 用户登录(WebView)
- 个人资料展示
- 我的话题列表
- 草稿管理
- 关注列表
- 粉丝列表
- 浏览历史
- 设置页面
- 版面搜索
- 话题搜索
- 图片缓存
- 图片查看器(支持多图滑动、缩放、双击放大)
- 浏览历史本地存储
- 字体大小设置
- 深色模式支持
- 错误处理与重试
- 翻页功能 - 话题详情页的翻页导航(上一页/下一页)
- 发帖功能 - 发布新话题
- 评论功能 - 回复话题和楼层
- 点赞功能 - 对话题和回复进行点赞/取消点赞
- 关注功能 - 关注/取消关注用户(目前仅支持查看关注列表)
- 黑名单功能 - 管理黑名单用户
- 修改密码 - 账户密码修改
- 绑定手机号 - 手机号绑定与验证
- 编辑帖子 - 编辑已发布的帖子
- 删除帖子 - 删除自己发布的帖子
- 举报功能 - 举报不当内容
- 私信功能 - 用户间私信交流
- 推送通知 - 消息推送提醒
| 平台 | 最低版本 | 状态 |
|---|---|---|
| iOS | 18.0+ | ✅ 完全支持 |
| iPadOS | 18.0+ | ✅ 完全支持 |
| macOS | 15.0+ | ✅ 完全支持 |
- Xcode 15.0+
- Swift 5.9+
- iOS 18.0+ / macOS 15.0+
# 克隆项目
git clone <repository-url>
cd Smth
# 打开项目
open Smth.xcodeproj
# 构建并运行 (Cmd + R)依赖通过 Swift Package Manager 管理,会自动下载。
# 代码规范检查
swiftlint --config swiftlint.yml
# 构建项目
xcodebuild -scheme Smth -project Smth.xcodeproj \
-destination 'platform=iOS Simulator,name=iPhone 16' build
# 运行测试
xcodebuild test -scheme Smth -destination 'platform=iOS Simulator,name=iPhone 16'- SwiftSoup (2.6.1) - HTML 解析
- Alamofire (5.8.0) - HTTP 网络请求
- ✅ ViewModel 单元测试
- ✅ Repository 测试
- ✅ 数据模型测试
- ⏳ UI 测试(待完善)
欢迎贡献代码!请遵循以下步骤:
- Fork 项目
- 创建功能分支 (
git checkout -b feature/AmazingFeature) - 提交更改 (
git commit -m 'Add some AmazingFeature') - 推送到分支 (
git push origin feature/AmazingFeature) - 开启 Pull Request
- 遵循 SwiftLint 规则
- 使用清晰的提交信息
- 为新功能添加测试
本项目采用 MIT 许可证。详见 LICENSE 文件。
- 感谢水木社区论坛
- 感谢所有贡献者的支持
如有问题或建议,请通过以下方式联系:
- 提交 Issue
- 开启 Pull Request
- 发送邮件: bitnpc@gmail.com
注意: 本项目仅供学习交流使用,请遵守水木社区的使用条款。
A modern SwiftUI client for NewSMTH forum (iOS / iPadOS / macOS). Built with MVVM + Repository architecture, featuring dependency injection, pagination support, and seamless multi-platform compatibility.
- ✅ Topic Browsing - Hot topics with pagination
- ✅ Board Navigation - Hierarchical board/sub-board navigation
- ✅ Topic Details - Complete topic content and replies
- ✅ Image Viewer - Multi-image browsing with swipe, zoom, and double-tap to zoom (UIKit on iOS, SwiftUI on macOS)
- ✅ User Login - WebView-based authentication
- ✅ Favorites - Favorite boards and topics management
- ✅ Messages - Inbox, mentions, replies, and likes
- ✅ Profile - User profile, topics, drafts, followers/following, browsing history
- ✅ Search - Board and topic search
- 🎨 Modern UI with unified theme system and dark mode
- 📱 Native experience on iOS, iPadOS, and macOS
- 🔄 Responsive layout for different screen sizes
- ⚡ Optimized loading states and error handling
- 💾 Local caching for browsing history and drafts
Built with MVVM + Repository pattern:
View (SwiftUI) → ViewModel → Repository → APIService
- Core: Authentication, Database, Dependency Injection, Networking, Utils
- Modules: Home, Favorite, Message, Profile, Search (MVVM structure)
- Components: Reusable UI components (including image viewer)
- Model: Data models and DTOs
- iOS: TabView navigation
- iPadOS: NavigationSplitView with sidebar
- macOS: NavigationSplitView with sidebar and content area
| Home | Favorites | Messages |
|---|---|---|
![]() |
![]() |
![]() |
| Profile | Settings | Login |
|---|---|---|
![]() |
![]() |
![]() |
- Hot topics list with pagination
- Board selector
- Topic detail page
- Article replies display
- Image attachments
- Pull to refresh
- Favorite boards and topics
- Board/topic switching
- Hierarchical board navigation
- Inbox, mentions, replies, likes
- Conversation details
- Message pagination
- User login (WebView)
- Profile display
- My topics, drafts
- Followers/following lists
- Browsing history
- Settings
- Board and topic search
- Image caching
- Image viewer (multi-image swipe, zoom, double-tap to zoom)
- Local storage (browsing history)
- Font size settings
- Dark mode support
- Error handling and retry
- Page navigation (prev/next page)
- Post new topics
- Reply to topics and posts
- Like/unlike functionality
- Follow/unfollow users
- Blacklist management
- Change password
- Bind phone number
- Edit/delete posts
- Report content
- Private messages
- Push notifications
| Platform | Min Version | Status |
|---|---|---|
| iOS | 18.0+ | ✅ Fully Supported |
| iPadOS | 18.0+ | ✅ Fully Supported |
| macOS | 15.0+ | ✅ Fully Supported |
- Xcode 15.0+
- Swift 5.9+
- iOS 18.0+ / macOS 15.0+
# Clone the repository
git clone <repository-url>
cd Smth
# Open in Xcode
open Smth.xcodeproj
# Build and run (Cmd + R)Dependencies are managed via Swift Package Manager and will be automatically resolved.
# Code linting
swiftlint --config swiftlint.yml
# Build
xcodebuild -scheme Smth -project Smth.xcodeproj \
-destination 'platform=iOS Simulator,name=iPhone 16' build
# Run tests
xcodebuild test -scheme Smth -destination 'platform=iOS Simulator,name=iPhone 16'- SwiftSoup (2.6.1) - HTML parsing
- Alamofire (5.8.0) - HTTP networking
- ✅ ViewModel unit tests
- ✅ Repository tests
- ✅ Data model tests
- ⏳ UI tests (pending)
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow SwiftLint rules
- Write clear commit messages
- Add tests for new features
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to NewSMTH forum
- Thanks to all contributors
For questions or suggestions:
- Open an Issue
- Create a Pull Request
- Email: bitnpc@gmail.com
Note: This project is for educational purposes only. Please comply with NewSMTH forum's terms of use.





