Many of our fully-coded iPhone app templates consist of a drawer menu navigation. This type of navigation usually is triggered by tapping on a menu button on the top left corner of the screen. Once clicked, the menu gets extended from the left side and takes over two-thirds of the screen. Here, the users can choose whatever option they want to navigate to. This type of app navigation is more popular in Android apps, but it gained some ground in the iOS realm as well, especially since concepts like Material design came out. People might also refer to this as hamburger menu navigation.
Check out the design mocks for our News Reader App Template, if you want a visual example of a drawer menu navigation.
The other popular type of navigation is using tabs. This is the preferred way of navigating iOS apps. Apple has built-in support for tab bars, which means you get it for free when you create a new Xcode project.
Implementing a slide menu on iOS in Swift 4 might seem challenging for a newcomer. It involves dealing with child view controllers and managing navigation controllers, which can look scary from outside. This is why many people prefer to use a 3rd party library for a drawer menu implementation. The technical difficulty of the implementation is actually just a cover. In reality, you can achieve this type of navigation with only several lines of code. So think twice before adopting a 3rd party CocoaPod, that’s very large in size, for achieving a simple task, such as a hamburger menu implementation.
Open sourcing our drawer menu implementation in Swift 4
So we’ve decided to open-source our drawer menu implementation in Swift 4. Yay! We think many iOS developers will benefit from this. We’re always happy to save development time! Check out the source code in Github: Slide Menu Implementation in Swift. The repository also contains a sample project, where you can find an example of how to use the DrawerController class. It’s really straightforward and it only takes 5 lines of code.
Let us know what you think! We’re always open to constructive feedback. We’re looking forward to adding more enhancements and functionalities to this open-source project. And at the same time keep it as simple as possible. Enjoy!