Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

robbieduncan

Moderator emeritus
Original poster
Jul 24, 2002
25,611
893
Harrogate
I have just released my first Swift UI App (thread). This is entirely SwiftUI (no uses of UIViewControllerRepresentable). If anyone wants to ask me how I did anything in the app please ask questions and I'll try and answer...
 

casperes1996

macrumors 604
Jan 26, 2014
7,593
5,764
Horsens, Denmark
Hehe, I clicked on this thread thinking "I think I know my way around SwiftUI well enough to answer whatever question is in here" - Was greeted by an offer to get my own question answered :p - Congrats on the app
 

robbieduncan

Moderator emeritus
Original poster
Jul 24, 2002
25,611
893
Harrogate
Hehe, I clicked on this thread thinking "I think I know my way around SwiftUI well enough to answer whatever question is in here" - Was greeted by an offer to get my own question answered :p - Congrats on the app
Hopefully we will get some questions we can answer between us :)

SwiftUI is really pretty simple right up to the point where it becomes really hard/something plain does not work :p

Let me pose a question then (for my next app I am working on).

If you have a hierarchical list have you found any way to enable drag/drop to re-arrange items? This is possible in normal lists using ForEach with the relevant modifiers on the ForEach but hierarchical lists don't use ForEach and List does not support onInsert (for example)
 

casperes1996

macrumors 604
Jan 26, 2014
7,593
5,764
Horsens, Denmark
If you have a hierarchical list have you found any way to enable drag/drop to re-arrange items? This is possible in normal lists using ForEach with the relevant modifiers on the ForEach but hierarchical lists don't use ForEach and List does not support onInsert (for example)
Hm. Interesting question - It's not really something I've had to deal with so I haven't thought much about it. I can't really off the top of my head think of any way to make that work with the List view. Seems like it ought to be possible but it doesn't seem like there's an easy way around it right now - without having looked much into it
 

robbieduncan

Moderator emeritus
Original poster
Jul 24, 2002
25,611
893
Harrogate
Hm. Interesting question - It's not really something I've had to deal with so I haven't thought much about it. I can't really off the top of my head think of any way to make that work with the List view. Seems like it ought to be possible but it doesn't seem like there's an easy way around it right now - without having looked much into it
I was wondering if there was something I have missed as I can't see any way round it either beyond basically re-implementing the functionality using ForEach and DisclosureGroup. Which I may end up doing but really don't fancy as getting the insertion position correct means messing with coordinate spaces which is normally pain!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.