From c4007f4a0f3496e1d99ecd2407895085a406b518 Mon Sep 17 00:00:00 2001 From: Jason Morley Date: Thu, 18 Jul 2024 15:24:00 -1000 Subject: [PATCH] feat: Support renaming files --- Reconnect/Views/BrowserDetailView.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Reconnect/Views/BrowserDetailView.swift b/Reconnect/Views/BrowserDetailView.swift index 50debb1..986c4b7 100644 --- a/Reconnect/Views/BrowserDetailView.swift +++ b/Reconnect/Views/BrowserDetailView.swift @@ -26,6 +26,14 @@ struct BrowserDetailView: View { var browserModel: BrowserModel + func name(for entry: FileServer.DirectoryEntry) -> Binding { + return Binding { + entry.name + } set: { name in + print(name) + } + } + var body: some View { @Bindable var browserModel = browserModel ZStack { @@ -34,7 +42,9 @@ struct BrowserDetailView: View { Image(file.fileType.image) } .width(16.0) - TableColumn("Name", value: \.name) + TableColumn("Name") { file in + TextField("", text: name(for: file)) + } TableColumn("Date Modified") { file in Text(file.modificationDate.formatted(date: .long, time: .shortened)) .foregroundStyle(.secondary)