Skip to content

Commit 7e30f6d

Browse files
authored
Merge pull request #11 from v2er-app/feature/add-claude-documentation
2 parents b06f2e5 + f74a4fd commit 7e30f6d

File tree

3 files changed

+112
-0
lines changed

3 files changed

+112
-0
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "website"]
2+
path = website
3+
url = git@github.com:v2er-app/v2er.app.git

CLAUDE.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
V2er is a V2EX forum client built for iOS using SwiftUI. It implements a Redux-like unidirectional data flow architecture for state management.
8+
9+
## Development Commands
10+
11+
Since this is an Xcode project, most development is done through Xcode IDE. However, for command-line operations:
12+
13+
```bash
14+
# Build the project
15+
xcodebuild -project V2er.xcodeproj -scheme V2er -configuration Debug build
16+
17+
# Run tests
18+
xcodebuild test -project V2er.xcodeproj -scheme V2er -destination 'platform=iOS Simulator,name=iPhone 14'
19+
20+
# Archive for App Store release
21+
xcodebuild archive -project V2er.xcodeproj -scheme V2er -archivePath V2er.xcarchive
22+
23+
# Clean build folder
24+
xcodebuild clean -project V2er.xcodeproj -scheme V2er
25+
26+
# Build for specific simulator
27+
xcodebuild -project V2er.xcodeproj -scheme V2er -sdk iphonesimulator -configuration Debug
28+
```
29+
30+
## Architecture
31+
32+
### Redux-like State Management
33+
34+
The app uses a centralized state management pattern similar to Redux:
35+
36+
1. **Store** (`V2er/State/DataFlow/Store.swift`): Single source of truth for application state
37+
2. **Actions** (`V2er/State/DataFlow/Actions/`): Define state mutations
38+
3. **Reducers** (`V2er/State/DataFlow/Reducers/`): Handle state updates based on actions
39+
4. **States** (`V2er/State/`): Individual state containers for features
40+
41+
### Key Components
42+
43+
- **APIService** (`V2er/State/Networking/APIService.swift`): Central API handling for V2EX endpoints
44+
- **SwiftSoup**: Used for HTML parsing of V2EX content
45+
- **Kingfisher**: Image loading and caching
46+
- **SwiftUI-WebView**: Web content display
47+
- **Rich Text Rendering**: Custom implementation for V2EX content format
48+
49+
### View Organization
50+
51+
Views are organized by feature in `V2er/View/`:
52+
- `Feed/`: Main topic feed
53+
- `FeedDetail/`: Topic details and replies
54+
- `Login/`: Authentication flow (including two-step login)
55+
- `Me/`: User profile and settings
56+
- `Message/`: Notifications
57+
- `Explore/`: Discovery and search
58+
- `Settings/`: App preferences
59+
- `Widget/`: Reusable UI components
60+
61+
## Key Implementation Details
62+
63+
### Authentication
64+
- Supports V2EX's standard login and two-step verification
65+
- Login state managed in `LoginState.swift` and `LoginReducer.swift`
66+
- Credentials persisted via `Persist.swift`
67+
68+
### Content Parsing
69+
- V2EX HTML content parsed using SwiftSoup
70+
- Rich text rendering implemented with custom `RichText.swift` and `HtmlView.swift`
71+
- Special handling for V2EX-specific content formats
72+
73+
### State Updates
74+
When implementing new features:
75+
1. Define actions in appropriate `*Actions.swift` file
76+
2. Create/update state in `*State.swift`
77+
3. Implement reducer logic in `*Reducer.swift`
78+
4. Connect to views using `@EnvironmentObject` Store
79+
80+
### API Integration
81+
- All API calls go through `APIService.swift`
82+
- Endpoints defined in `Endpoint.swift`
83+
- HTML responses parsed into Swift models
84+
- Network errors handled via `NetworkException.swift`
85+
86+
## Dependencies
87+
88+
Managed via Swift Package Manager:
89+
- **Kingfisher**: Image loading
90+
- **SwiftSoup**: HTML parsing
91+
- **SwiftUI-WebView**: Web content
92+
- **Atributika**: Rich text attributes
93+
94+
## Testing
95+
96+
Tests are located in:
97+
- `V2erTests/`: Unit tests
98+
- `V2erUITests/`: UI tests
99+
100+
Currently contains only boilerplate test setup.
101+
102+
## Important Notes
103+
104+
- Minimum iOS version: iOS 15.0
105+
- Supported architectures: armv7, arm64
106+
- Orientation: Portrait only on iPhone, all orientations on iPad
107+
- UI Style: Light mode enforced
108+
- Website submodule: Located at `website/` (separate repository)

website

Submodule website added at c3bbc04

0 commit comments

Comments
 (0)