import SwiftUI /// Mini-Editor in der Share-Extension. User kann den Text noch /// anpassen, dann "Speichern" → PendingShare landet in der Haupt-App. struct ShareEditorView: View { let initialText: String let sourceURL: String? let onSave: (String) -> Void let onCancel: () -> Void @State private var text: String init( text: String, sourceURL: String?, onSave: @escaping (String) -> Void, onCancel: @escaping () -> Void ) { initialText = text self.sourceURL = sourceURL self.onSave = onSave self.onCancel = onCancel _text = State(initialValue: text) } var body: some View { NavigationStack { Form { Section("Vorderseite") { TextField("Text", text: $text, axis: .vertical) .lineLimit(4 ... 10) } if let sourceURL { Section("Quelle") { Text(sourceURL) .font(.caption) .foregroundStyle(.secondary) .lineLimit(1) } } Section { Text("Wähle das Ziel-Deck in der Cardecky-App.") .font(.caption) .foregroundStyle(.secondary) } } .navigationTitle("Als Karte speichern") .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .cancellationAction) { Button("Abbrechen", action: onCancel) } ToolbarItem(placement: .confirmationAction) { Button("Speichern") { onSave(text) } .disabled(text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty) } } } } }