-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathswift-conventions.mdc
More file actions
34 lines (25 loc) · 1.02 KB
/
swift-conventions.mdc
File metadata and controls
34 lines (25 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
description: Swift coding conventions for the iOS plugin
globs: "**/*.swift"
alwaysApply: false
---
# Swift Conventions (iOS Plugin)
## Project Setup
- Swift 5.3, iOS deployment target: 11.0
- Pod: `usercentrics_sdk`, depends on `UsercentricsUI`
- Plugin registration via ObjC (`UsercentricsPlugin.m/.h`)
## Architecture
- `SwiftUsercentricsPlugin.swift` - Main plugin logic
- `API/` - Proxy abstractions (`UsercentricsProxy`, `UsercentricsBannerProxy`, `FlutterAssetProvider`)
- `Bridge/` - One bridge per SDK method, conforming to `MethodBridge`
- `Serializer/` - One serializer per data type
## Patterns
- Each bridge class handles one MethodChannel call
- Serializers convert native Usercentrics types to Flutter-compatible dictionaries
- Tests live in `example/ios/RunnerTests/` using XCTest
- `UCFlutterFlag` controls feature flags
## Code Style
- Follow Swift API design guidelines
- Use `struct` for value types, `class` for reference types
- Keep bridge classes single-responsibility
- Prefer guard-let over nested if-let