39 lines
945 B
Swift
39 lines
945 B
Swift
//
|
|
// NameAndValueLabelStyle.swift
|
|
// Profile
|
|
//
|
|
// Created by Javier Cicchelli on 03/12/2022.
|
|
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct NameAndValueLabelStyle: LabelStyle {
|
|
func makeBody(configuration: Configuration) -> some View {
|
|
VStack(
|
|
alignment: .leading,
|
|
spacing: 0
|
|
) {
|
|
configuration.icon
|
|
.font(.subheadline)
|
|
.foregroundColor(.secondary)
|
|
|
|
configuration.title
|
|
.font(.headline)
|
|
.lineLimit(1)
|
|
.truncationMode(.middle)
|
|
.foregroundColor(.primary)
|
|
.frame(maxWidth: .infinity, alignment: .trailing)
|
|
}
|
|
.padding(.vertical, 8)
|
|
}
|
|
}
|
|
|
|
// MARK: - LabelStyle
|
|
|
|
extension LabelStyle where Self == NameAndValueLabelStyle {
|
|
static var nameAndValue: Self {
|
|
NameAndValueLabelStyle()
|
|
}
|
|
}
|