Apologies
You must be signed in to watch this lesson.
Drag and Drop Pt.2
Podcasts
Now that we've established some fundamental rules with how to drag our Player view around, let's move onto some additional improvements that we can implement in today's lesson. First we'll discuss how to maximize and minimize our player whenever we let go over the dragging action. Finally we go over the many bugs that we have with our current animation code. Enjoy.

Comments (6)
zcrystal
6 years ago
Hey Brian, the pan gesture bug that you mostly eliminated is still present when the app launches.
Brian Voong
6 years ago
Tube
6 years ago
If one uses Refactor / Extract Method, Xcode tries to put in the correct argument list, e.g., fileprivate func handlePanGestureEnded(_ translation: CGPoint, _ velocity: CGPoint). Very handy.
rinconchris
6 years ago
Hi Brian - another great video. Regarding debugging the layout constraints, do you ever use the console suggestion to 'Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger'? Useful or not for this type of situation?
Brian Voong
6 years ago
Alpensol
6 years ago
Hey Brian, Thanks for the videos, I have a question, how would you go about refactoring the Player out of the View file? Could we create a separate file for the Player and then use it, the problem for me is understanding how to setup those observables for the timing features once we refractor the player out.
ncgreene
5 years ago
Hey Brian, I found and fixed a minor visual bug. You can cause the bug by dragging the miniPlayerView up past "200" pixels. Doing so will cause the miniPlayerView to briefly flicker back into sight. Based on my fix, I believe it has to do with a very large translation assigning a negative alpha value. Anyways, here's the code that should be changed: replace: self.miniPlayerView.alpha = 1 + (translation.y / 200) with: let newAlpha = 1 + translation.y / 200 self.miniPlayerView.alpha = newAlpha < 0 ? 0 : newAlpha
ncgreene
5 years ago
Clarification: drag up past "200" pixels and then release it. When it reaches the top, that is when the miniPlayerView will flicker back into sight.
Brian Voong
5 years ago
李承諴
3 years ago
Hi Brian In 04:23 Why you put the code of "maximize player" in the animation code of "minimize player"? And it still works perfectly?
HELP & SUPPORT