Here is some code snippets:
...
ForEach(pngs) { row in
TableRow(row)
.itemProvider {
row.targetURL.flatMap(NSItemProvider.init(contentsOf:))
}
}
...
.onDrop(of: [.png], isTargeted: $isDropTarget) { providers in
files.removeAll()
providers.forEach { provider in
_ = provider.loadFileRepresentation(for: .png, openInPlace: true) { url, _, _ in
Task { @MainActor in
url.map {
files.append(.init(url: $0))
}
}
}
}
return true
}
...
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: