同步已迁移的 iOS 模块

This commit is contained in:
2026-06-22 15:35:12 +08:00
parent 0a0d4fbd79
commit 08465fffde
48 changed files with 4455 additions and 15 deletions

View File

@ -13,6 +13,9 @@ enum AppDesign {
static let primarySoft = Color(hex: 0xEFF6FF)
static let textPrimary = Color(hex: 0x1F2937)
static let textSecondary = Color(hex: 0x6B7280)
static let placeholder = Color(hex: 0xA8B2C1)
static let success = Color(hex: 0x14964A)
static let warning = Color(hex: 0xFF7B00)
}
extension Color {
@ -27,3 +30,16 @@ extension Color {
)
}
}
extension View {
///
func appInputFieldStyle(cornerRadius: CGFloat, minHeight: CGFloat) -> some View {
padding(.horizontal, AppMetrics.Spacing.medium)
.frame(minHeight: minHeight)
.background(Color(hex: 0xF8FAFC), in: RoundedRectangle(cornerRadius: cornerRadius))
.overlay {
RoundedRectangle(cornerRadius: cornerRadius)
.stroke(Color(hex: 0xE2E8F0), lineWidth: 1)
}
}
}

View File

@ -32,6 +32,34 @@ struct ListPayload<T: Decodable>: Decodable {
}
}
/// total + data list
struct DataListPayload<T: Decodable>: Decodable {
let total: Int
let data: [T]
/// JSON
enum CodingKeys: String, CodingKey {
case total
case data
case list
}
///
init(total: Int, data: [T]) {
self.total = total
self.data = data
}
/// data/list total
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
total = try container.decodeLossyInt(forKey: .total) ?? 0
data = try container.decodeIfPresent([T].self, forKey: .data)
?? container.decodeIfPresent([T].self, forKey: .list)
?? []
}
}
private extension KeyedDecodingContainer {
/// IntDouble
func decodeLossyInt(forKey key: Key) throws -> Int? {