simplify Exercise to only hold on to the unit of the metric, remove ValueKeyboard as input
This commit is contained in:
@@ -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)")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user