I have a List with draggable items. According to this thread (https://developer.apple.com/forums/thread/664469) I had to use .itemProvider instead of .onDrag, because otherwise the selection of the list will not work anymore.
The items in my list refer to a file URL. So the dragging allowed to copy the files to the destination of the drag & drop. Therefore I used this code
.itemProvider {
let url = ....... // get the url with an internal function
return NSItemProvider(object: url as NSURL)
}
Since the update to macOS 15.1 this way isn't working anymore. It just happens nothing.
I also tried to use
.itemProvider {
let url = ....
return NSItemProvider(contentsOf: url) ?? NSItemProvider(object: url as NSURL)
}
but this doesn't work too.
The same way with .onDrag works btw.
.onDrag {
let url = ....... // get the url with an internal function
return NSItemProvider(object: url as NSURL)
}
but as I wrote, this will break the possibility to select or to use the primaryAction of the .contextMenu.
Is this a bug? Or is my approach wrong and is there an alternative?
Post
Replies
Boosts
Views
Activity
In one of my applications I use several List views with Sections. After upgrading to Sequoia I faced the issue, that after selecting an item, the List suddenly scrolls to a different position. Sometimes the selection even gets out of the view, but in every case a double click just went to the wrong item.
At one list I found out, that the issue could be solved after changing the data source. I used a computed property, what seems to be a stupid idea. After changing this it now works.
Unfortunately there is another List, where this didn't bring the solution. And unfortunately, I cannot reproduce the issue in a code example. One guess of mine is, that it could be related to the fact, that the rows have different heights (because in some are two lines of text and in some are three). And it seems to happen only in very long lists.
It worked perfectly in Sonoma.
Does anyone face the same issue?
I would like to get notified, when a specific file gets opened or closed by another application.
I tried different things like DispatchSource, FSEvents and kqueue, but nothing worked. The only option so far is searching for all process ids, that accesses the file with proc_listpidspath (or with the command line tool lsof). Unfortunately I need to use a Timer for this. But checking i. e. every second will need a lot of CPU, so I'm curious, if there is a built in notification in macOS?
Is it possible in SwiftUI to have a tabbed interface like in Safari? The videos of the WWDC only shows that you can group several windows on macOS to tabs, but is this possible in iPadOS as well and can I create tabs programmatically?
Hi, I created a new project with Xcode 12 beta on Big Sur beta. I changed the code in the @main-wrapper to this:
	@Environment(\.scenePhase) private var scenePhase
var body: some Scene {
WindowGroup {
ContentView()
}
.onChange(of: scenePhase) { (newScenePhase) in
print(newScenePhase)
}
}
If I start the application (either macOS or iOS), nothing happens, nothing will be printed in the onChange. Do I miss something?