Files
Termind/Frameworks/TermindPresentation/HostSystemIcon.swift
T
Kaede Akino c2958a05b3 Add iOS workspaces and shared feature services
Share Vault, persistence, SSH/SFTP, forwarding, and SwiftUI components across platforms. Add mobile editors, terminal input, standalone Assistant, Metrics navigation, transfers, and a unified Live Activity with host system icons.

Validation: 35 iOS tests and 100 focused macOS tests pass; formatting and zh-Hans checks pass. The full macOS run reports 14 issues in the documented timing, Keychain, and popover suites. Remaining Assistant tool and CloudKit work is tracked in Memory/MOBILE_ROLLOUT.md.
2026-09-11 13:47:16 +08:00

30 lines
969 B
Swift

import SwiftUI
/// The same system artwork in a host row and a workspace's Live Activity link.
public struct HostSystemIcon: View {
private let asset: String?
private let size: CGFloat
private let showsBackground: Bool
public init(asset: String?, size: CGFloat = 32, showsBackground: Bool = true) {
self.asset = asset
self.size = size
self.showsBackground = showsBackground
}
public var body: some View {
Group {
if let asset {
Image(asset, bundle: .main).resizable().scaledToFit()
} else {
Image(systemName: "server.rack").resizable().scaledToFit()
}
}
.foregroundStyle(.tint)
.padding(showsBackground ? size * 0.2 : 0)
.frame(width: size, height: size)
.background(.tint.opacity(showsBackground ? 0.16 : 0), in: RoundedRectangle(cornerRadius: size * 0.25))
.accessibilityHidden(true)
}
}