Menu Slide Out with Xcode, Swift

The Slide Out view I created.
Press the + sign in the Assets.xcassets folder and create an Image Set then Drag and Drop the Icon as showed above. This is really important because if you want an Icon for your button, you’ll need to select the image in your Attributes Inspector that is described below.
Notice how under Bar Item I selected an image called ‘hamburger’, that is the Icon I dragged into my Assets.xcassets folder. When I select hamburger my menu Icon will change.
Note: you can change the positioning of your Bar Button Item by selecting it and heading over to Size Inspector. I would suggest to edit the positioning of the button to your needs.
Resize the View to fit the screen, we will be adding Buttons in this View that users can tap.
You can have a different width, it’s good to keep in mind that we’ll be using this width to manipulate the View so it doesn’t show unless the Menu Button is tapped.
I edited the text to white on this button and re-sized the length.
Select the leading constraint in your View then create an outlet by control dragging the constraint to your Assistant Editor. The name of the constraint will change also.
I created an Action for the menu icon and named it openMenu, when the user taps this icon it will bring up the Slide Out Menu.
This is how your code should look so far.
This is how the code should look.

EDIT: Make sure you set the alignment X: to -140 for the side View in the Size Inspector:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adeel Kothiwala

Adeel Kothiwala


Helping men around the world feel their best self & escape the matrix