VibeCoding工程流程学习二:iOS项目架构

前言

构建一个可以复用的iOS项目结构,要求方便测试方便扩展,组件化,主要构建思想为clean architecure, swiftject 进行解耦,通过spm 拆分组件。详细项目地址为Demo

🛠 技术架构

Technology Purpose
Swift 5 Language
SwiftUI UI Framework (iOS 15+)
Swift Package Manager Modular dependency management
RxSwift 6.x / RxCocoa Reactive programming (Domain, Data, Networking)
Combine Reactive UI bindings (Presentation layer only)
Swinject 2.x Dependency Injection container
WKWebView Web content embedding + JS bridge
URLSession HTTP networking (via RxSwift wrappers)

📁 项目结构

ruby 复制代码
MyEcommerce/
├── MyEcommerce/                          # App entry point
│   ├── MyEcommerceApp.swift              # @main --- DI registration + navigation
│   ├── Routing/
│   │   └── AppWebRouteFactory.swift      # Composition root for WebContainer routing
│   └── Assets.xcassets/                  # App icons, colors, resources
│
├── Packages/                              # ★ All business logic as SPM packages
│   ├── Abstraction/                      # Pure protocol layer
│   ├── Domain/                           # Use case implementations
│   ├── Data/                             # Repository + service implementations
│   ├── Presentation/                     # SwiftUI feature packages
│   │   ├── LoginFeature/                 # LoginView + LoginViewModel
│   │   ├── ProductsFeature/             # ProductList + ItemDetail
│   │   ├── BasketFeature/               # BasketView + BasketViewModel
│   │   └── WebContainerFeature/         # WKWebView embedding + JS bridge
│   └── Utilities/                        # Cross-cutting utilities
│       ├── Networking/API/              # HTTP client, mock provider, environment
│       ├── Utils/                       # RxSwift → Combine bridge
│       └── Analytics/                   # Event tracking wrapper
│
├── MyEcommerceTests/                     # Unit test scaffold
├── MyEcommerceUITests/                   # UI test scaffold
│
├── CLAUDE.md                             # AI coding assistant instructions
├── docs/
│   ├── architecture.md                   # Architecture documentation (Chinese)
│   └── plans/                            # Implementation plans
│
└── .claude/                              # Claude Code configuration
相关推荐
茶底世界之下20 小时前
雨天的窗边:用 Awaking 轻轻提亮一盆蕨
ios·app·产品
景彬2 天前
强制升级 Xcode 后,一个 10 年老项目有哪些改动点
ios
愤怒的代码2 天前
什么是 harness:把会思考的模型,改造成能行动的 Agent
agent·ai编程·vibecoding
茶底世界之下2 天前
海边书店的阴天:用 Awaking 留住青绿与暖灯
ios·app·产品
布莱克6052 天前
Swift 类详解:从定义、继承到内存管理的完整指南
服务器·开发语言·ios·ssh·swift·类
布莱克6053 天前
Swift 方法详解:实例方法、类型方法与 mutating 机制
服务器·开发语言·ios·ssh·swift·方法
茶底世界之下3 天前
旧电影院的红座椅:用 Awaking 留住放映前的光
ios·app·产品
茶底世界之下4 天前
洗衣房的午后斜光:用 Awaking 把光和影分开
ios·app·产品
我是谁的程序员5 天前
iOS 性能分析在 Windows 上怎么做,用 KXBuild 的 kxdevice 替代 Instruments
后端·ios
开心就好20255 天前
通配符 Bundle ID 和精确 Bundle ID 怎么选,推送、iCloud 能不能用通配符
后端·ios