40 lines
787 B
Swift
40 lines
787 B
Swift
//
|
|
// MarkView.swift
|
|
// TTTKit
|
|
//
|
|
// Created by Shadowfacts on 12/21/22.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
@available(iOS 16.0, *)
|
|
struct MarkView: View {
|
|
let mark: Mark?
|
|
|
|
var body: some View {
|
|
maybeImage.aspectRatio(1, contentMode: .fit)
|
|
}
|
|
|
|
@ViewBuilder
|
|
private var maybeImage: some View {
|
|
if let mark {
|
|
Image(systemName: mark == .x ? "xmark" : "circle")
|
|
.resizable()
|
|
.fontWeight(mark == .x ? .regular : .semibold)
|
|
} else {
|
|
Color.clear
|
|
}
|
|
}
|
|
}
|
|
|
|
@available(iOS 16.0, *)
|
|
struct MarkView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
HStack {
|
|
MarkView(mark: .x)
|
|
MarkView(mark: .o)
|
|
MarkView(mark: nil)
|
|
}
|
|
}
|
|
}
|