chore: core 多模块骨架
This commit is contained in:
16
IosClientKit/Sources/CoreUI/EmptyStateView.swift
Normal file
16
IosClientKit/Sources/CoreUI/EmptyStateView.swift
Normal file
@@ -0,0 +1,16 @@
|
||||
import SwiftUI
|
||||
|
||||
/// 空状态占位视图。
|
||||
public struct EmptyStateView: View {
|
||||
private let title: String
|
||||
private let systemImage: String
|
||||
|
||||
public init(title: String, systemImage: String = "tray") {
|
||||
self.title = title
|
||||
self.systemImage = systemImage
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
ContentUnavailableView(title, systemImage: systemImage)
|
||||
}
|
||||
}
|
||||
22
IosClientKit/Sources/CoreUI/ErrorView.swift
Normal file
22
IosClientKit/Sources/CoreUI/ErrorView.swift
Normal file
@@ -0,0 +1,22 @@
|
||||
import SwiftUI
|
||||
|
||||
/// 错误占位视图(带重试)。
|
||||
public struct ErrorView: View {
|
||||
private let message: String
|
||||
private let retry: () -> Void
|
||||
|
||||
public init(message: String, retry: @escaping () -> Void) {
|
||||
self.message = message
|
||||
self.retry = retry
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
ContentUnavailableView {
|
||||
Label("出错了", systemImage: "exclamationmark.triangle")
|
||||
} description: {
|
||||
Text(message)
|
||||
} actions: {
|
||||
Button("重试", action: retry)
|
||||
}
|
||||
}
|
||||
}
|
||||
11
IosClientKit/Sources/CoreUI/LoadingView.swift
Normal file
11
IosClientKit/Sources/CoreUI/LoadingView.swift
Normal file
@@ -0,0 +1,11 @@
|
||||
import SwiftUI
|
||||
|
||||
/// 加载中占位视图。
|
||||
public struct LoadingView: View {
|
||||
public init() {}
|
||||
|
||||
public var body: some View {
|
||||
ProgressView("加载中…")
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
}
|
||||
}
|
||||
16
IosClientKit/Sources/CoreUI/PlaceholderView.swift
Normal file
16
IosClientKit/Sources/CoreUI/PlaceholderView.swift
Normal file
@@ -0,0 +1,16 @@
|
||||
import SwiftUI
|
||||
|
||||
/// 尚未实现的 Tab 占位视图。
|
||||
public struct PlaceholderView: View {
|
||||
private let title: String
|
||||
private let systemImage: String
|
||||
|
||||
public init(_ title: String, systemImage: String) {
|
||||
self.title = title
|
||||
self.systemImage = systemImage
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
ContentUnavailableView(title, systemImage: systemImage)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user