simplify Exercise to only hold on to the unit of the metric, remove ValueKeyboard as input

This commit is contained in:
Felix Förtsch
2024-10-02 12:41:04 +02:00
parent 41a82f081a
commit b7f5caf9dd
15 changed files with 630 additions and 243 deletions
@@ -0,0 +1,33 @@
//
// TextEditorWithPlaceholder.swift
// WorkoutsPlus
//
// Created by Felix Förtsch on 01.10.24.
//
import SwiftUI
struct TextEditorWithPlaceholder: View {
@Binding var text: String
var placeholder: String
var body: some View {
ZStack(alignment: .topLeading) {
// TODO: If focused, hide placeholder.
if text.isEmpty {
Text(placeholder)
.foregroundColor(Color(UIColor.placeholderText))
}
TextEditor(text: $text)
.frame(minHeight: 40, maxHeight: .infinity)
.cornerRadius(8)
}
}
}
#Preview {
@Previewable @State var text = ""
Form {
TextEditorWithPlaceholder(text: $text, placeholder: "Description (optional)")
}
}