In my macOS app I need to allow the user get a list of absolute local file URLs by selecting them from Finder using copy-and-paste or drag-and-drop. I'll filter them by the extension ".raw" and they should go, I think, in an array of URL. My experience using an app that support this suggests that I should implement both. I do know how to code a file-picker but that's not what I want.
I've been using Dr. Google to search but what I have found doesn't come close to illustrate what I need are too complex for me to understand enough to use as a guide.
Here is an example of one from an on-line tutorial that kind of works as a C&P but it's far from what I need. It also produces this: "CLIENT ERROR: TUINSRemoteViewController does not override -viewServiceDidTerminateWithError: and thus cannot react to catastrophic errors beyond logging them" so it's not really good code.
struct DataChooserView: View {
@State private var username = "@twostraws"
var body: some View {
VStack {
TextField("Username", text: $username)
.textFieldStyle(.roundedBorder)
PasteButton(payloadType: String.self) { strings in
guard let first = strings.first else { return }
username = first
}
.buttonBorderShape(.capsule)
}
.padding()
}
}
I'm inexperienced in Swift/SwiftUI but learning.