Camera Custom Transitions
Instagram Firebase
With our camera now implemented inside our application, let's look at integrating a custom transition that slides it over from the left. Building out this behavior is a little advanced, so I'll walk through each step with as much detail as I can. When we get the presentation behavior correct, we'll look at creating the reverse transition for dismissal.

Comments (15)
Slava Nagornyak
6 years ago
Hi Brian! Thank you for this sneak pick for custom animation transitions. But I think it'll be very interesting for everybody to know how to implement this same transitions interactable. Thank you in advance
Brian Voong
6 years ago
ryanpeters
6 years ago
Hey Brian! Can you address how to solve the delay during the presenting transition please? Thanks!
Brian Voong
6 years ago
ryanpeters
6 years ago
Nope, the delay is apparent in every occurrence when presenting the camera for me, and there is no delay when moving back to the home controller or any other presenting calls, so it would make sense that the delay is related to loading up the libraries needed for the camera. I'm using an iPhone 6 so maybe the delay would be due to the older hardware, but unlikely I think as other applications have a much smoother camera transition. Thanks again!
Brian Voong
6 years ago
ryanpeters
6 years ago
I noticed the same thing, I'll implement that optimization after I finish the course. Thanks for the replies Brian, can't wait for the next course!
Hen Shabat
6 years ago
Can you help with change to front camera? Thanks!!!
victor
6 years ago
Hey Brian Awesome transitions! I just wanted to ask if anyone noticed this issue. Everytime I happened to launch the app in landscape mode, then switch to portrait the auto-layout goes haywire until I tap to a different viewController. Just wondering why this is happening since we had already set the constraints in the UIView extension for anchor. thanks
Yu Hao Chen
6 years ago
so amazing,thank Brian
mayakei
5 years ago
Hi Brian, thank you for the great tutorial. Just wondering why you don't need to set startingFrame for toView in CustomAnimationDismisser as you did in CustomAnimationPresentor? Is that because the frame of the toView in Dissmisser (HomeController) still stays at the same position after the Presenter has transition completed?
Brian Voong
5 years ago
wealthnut79
5 years ago
how can i tell if my code is working properly if im using the Xcode Simulator?
lexiddie
5 years ago
I can't get this to work because my ViewController implement navigation controller, please help Brain.
esong2288
5 years ago
Hey Brian, how do they keys of .to and .from know which view controller they should refer to. For example in the Presentor class, how does the app know the .to key refers to the CameraController.
Brian Voong
5 years ago
esong2288
5 years ago
Oh ok and also would these work with pushing onto a table view controller or would I have to work with custom segues or something like that
Yevhenii
5 years ago
It will work, because UITableViewController inherits from UIViewController (Apple docs https://developer.apple.com/documentation/uikit/uitabbarcontroller).
esong2288
5 years ago
Gotcha thanks so much!!
廖豪豪
4 years ago
Awesome tutorial, thanks Brian!
anantangad
4 years ago
Hey Brian, When I run my app on iPhone X just to play around with images in the home feed, I'm not able to put my image on the top of the screen. I'm currently using topAnchor for my top anchor. I know you talked about safeAreaLayoutGuide, but that doesn't seem to work.
anantangad
4 years ago
I just need the top image to be on the top of the screen just to see how safe layout works.
MaxApp
4 years ago
Hey Brian, would you ever consider building an app like Snapchat where it involves video features?
Brian Voong
4 years ago
MaxApp
4 years ago
Alright, I will do a sketch file where I will prototype the app and highlight the main features!
Brian Voong
4 years ago
Cinquain
4 years ago
This video is fire but it definitely needs to be watched twice
Kirk Washam
3 years ago
Hello, I have checked that my code is identical to the current download project. However, when I click the camera icon, the screen turns black, and the camera view controller slides in from the left as expected. When i click on the dismiss icon, both view controllers behave as expected. As of ios 13, I must add an additional line of code when presenting the CameraController let cameraController = CameraController() cameraController.modalPresentationStyle = .fullScreen <---- This line is required to prevent to view being displayed as a Page Sheet present(cameraController, ......) I believe this is causing my problem, as the Apple docs state that .fullScreen removes the presenting views. I'm not sure what the best approach is to solving this. Any help/advise would be appreciated. Thank You
Brian Voong
3 years ago
Kirk Washam
3 years ago
Perfect. Thanks man
HappyCow
3 years ago
When I implement the code and hit the camera button the view does not slide from the left, it continues to slide from the bottom: let startingFrame = CGRect(x: -toView.frame.width, y: 0, width: toView.frame.width, height: toView.frame.height) toView.frame = startingFrame Also, there is a space at the top of the screen screen and the code we added earlier to make the navigation bar go away is not working. I am thinking this may have to do with a new version of Xcode / iOS. Any idea how to fix this?
Kevin Liu
3 years ago
I think this has to do with iOS 13.
Brian Voong
3 years ago
Kevin Liu
3 years ago
Try adding "cameraController.modalPresentationStyle = .fullScreen" right after "let cameraController = CameraController()" in the handleCamera() method in HomeController.swift.
HappyCow
3 years ago
Awesome!! It worked. Thank you for Brian and Kevin for this fix :)
Kevin Liu
3 years ago
:-)
HELP & SUPPORT