Files
e-party-iOS/.cursor/rules/swift-tca-architecture-guidelines.mdc
edwinQQQ c470dba79c feat: 更新项目配置和功能模块
- 修改Package.swift以支持iOS 15和macOS 12。
- 更新swift-tca-architecture-guidelines.mdc中的alwaysApply设置为false。
- 注释掉AppDelegate中的NIMSDK导入,移除不再使用的NIMConfigurationManager和NIMSessionManager文件。
- 添加新的API相关文件,包括EMailLoginFeature、IDLoginFeature和相关视图,增强登录功能。
- 更新APIConstants和APIEndpoints以反映新的API路径。
- 添加本地化支持文件,包含英文和中文简体的本地化字符串。
- 新增字体管理和安全工具类,支持AES和DES加密。
- 更新Xcode项目配置,调整版本号和启动画面设置。
2025-07-09 16:14:19 +08:00

50 lines
1.4 KiB
Plaintext

---
alwaysApply: false
---
# TCA Architecture Guidelines
- Use The Composable Architecture (TCA) for state management and side effect handling.
- Define reducers for each feature and use @Reducer annotation.
- Use stores to manage state.
- Follow unidirectional data flow (state -> view -> action -> reducer -> state).
- Use @State to manage local state and @ObservedObject or @EnvironmentObject to manage shared state.
- Make sure all side effects (such as network requests) are handled in reducers using Effects.
- Divide reducers by functionality and define a root reducer.
- Use Dependency Injection to manage external dependencies (such as network, database).
- Write tests for reducers to ensure correct state transitions.
## Feature Structure
Each feature must include:
1. A `State` struct
2. An `Action` enum
3. A `Reducer`
4. A `View` (if applicable)
## Naming Conventions
- Feature: `{{FeatureName}}Feature`
- State: `{{FeatureName}}Feature.State`
- Action: `{{FeatureName}}Feature.Action`
- Reducer: `{{FeatureName}}Feature.reducer`
## Example
```swift
struct CounterFeature {
struct State: Equatable {
var count = 0
}
enum Action: Equatable {
case increment
case decrement
}
static let reducer = Reducer<State, Action, Void> { state, action, _ in
switch action {
case .increment:
state.count += 1
return .none
case .decrement:
state.count -= 1
return .none
}
}
}