Group Group Group Group Group Group Group Group Group

Progress and Spring Loading in Ch. 7 - Advanced Drag and Drop


Hi! I’m really enjoying the iOS 11 book.

I’ve read the chapter 7, Advanced Drag and Drop, but 2 things weren’t clear for me:

  1. In the Indicating progress section, it’s not clear who instantiates or passes the Progress? object;
  2. I couldn’t understand what was the relationship between the example and Spring Loading; and also I couldn’t find much on Documentation and WWDC videos.

Can someone explain a little bit more? Any chances we have more content added into that section?



Hi - happy to hear you’re enjoying the book!

Thanks for the feedback. Let me see if I can address your questions. I’ll try to clarify this further in my final author pass of the book when the iOS 11 GM is released.

  1. The Progress object is created the the NSItemProvider in charge of a specific item. In this chapter, you can look in HikeViewController.swift for the implementation of dropInteraction(_:performDrop) to see where we grab a reference. You call NSItemProvider’s loadObject which returns the progress of the load. Note that the Session also has a progress indicator - in this case we’re only copying a single item so we look directly at its progress. Here’s a relevant part of a WWDC session covering this:

  2. Spring loading is traditionally about navigation, so I see your confusion. You were probably expecting to drag an item to the springboard and see the app launch and do something with it. I’m not sure offhand if that’s even possible. However, all controls within an app are spring loadable. In the case of buttons, it simply means hovering over the button will fire its action. That’s exactly what we’ve done here with the delete button. It’s not very pretty to be honest, because there is no callback to let you manage the animation in that case. So you just see the button fire, and then a cancel animation occurs as if you hadn’t triggered it. Originally I wanted to do something with navigation via a tabbar button in this chapter I believe, but it wasn’t working at least in the early betas. I’ll revisit this during the GM pass and see if things have improved. For now, it’s a bit of a fringe topic in an already loaded chapter, so may be difficult to dive into further here. They cover this in the ‘Beginning Drag and Drop’ session at very high level detail. Here’s the link:

I hope that helps a bit, and again I’ll try to clarify in my final pass. Good luck getting drag and drop in your projects - it’s a killer feature!



Hi Jeff! Thank you so much for clarifying.

1 Like
closed #4

This topic was automatically closed after 166 days. New replies are no longer allowed.