Files

66 lines
1.6 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import Foundation
/// 首页模块跳转目标。
public enum ModuleDestination: Hashable, Sendable {
case checkin
case plan
case about
}
/// 首页功能模块卡片(打卡介绍 / 计划介绍 / 关于我们)。
public struct HomeModule: Identifiable, Hashable, Sendable {
public let id: String
public let emoji: String
public let title: String
public let description: String
public let destination: ModuleDestination
public init(
id: String,
emoji: String,
title: String,
description: String,
destination: ModuleDestination
) {
self.id = id
self.emoji = emoji
self.title = title
self.description = description
self.destination = destination
}
}
/// 产品介绍卡片。
public struct IntroCard: Hashable, Sendable {
public let title: String
public let body: String
public init(title: String, body: String) {
self.title = title
self.body = body
}
}
/// 首页聚合数据(落地页)。
public struct HomeData: Hashable, Sendable {
public let greeting: String
public let displayName: String
public let encouragement: String
public let modules: [HomeModule]
public let intros: [IntroCard]
public init(
greeting: String,
displayName: String,
encouragement: String,
modules: [HomeModule],
intros: [IntroCard]
) {
self.greeting = greeting
self.displayName = displayName
self.encouragement = encouragement
self.modules = modules
self.intros = intros
}
}