Home

Awesome

<img width="1280" alt="banner" src="https://github.com/SimformSolutionsPvtLtd/SSSwiftUISideMenu/assets/63283381/c9485bc9-c753-4f5d-b165-be6b65f8c843">

SSSwiftUISideMenu

Version Platform Swift Version PRs Welcome Twitter

SSSwiftUISideMenu: Effortless Side Navigation in SwiftUI

Create sleek and customizable side menus effortlessly in SwiftUI with SSSwiftUISideMenu. This SwiftUI library simplifies the implementation of side menus, allowing you to enhance the navigation and user experience of your iOS apps. With a focus on flexibility and ease of use, SSSwiftUISideMenu empowers developers to integrate stylish side menus seamlessly into their SwiftUI projects.

Features

Requirements

Example

Example of SSSwiftUISideMenu An example of Custom SideMenu created with this library

SSSwiftUISideMenu_example

Installation

CocoaPods

Manually

Swift Package Manager (SPM)

Usage Examples

import SSSwiftUISideMenu
    @State private var openSideMenu: Bool = false
    
    @State private var selectedIndex: Int = 0
    
    private var menuItems = [
        MenuItem(title: "item_1", icon: "icon_1"),
        MenuItem(title: "item_2", icon: "icon_2"),
        MenuItem(title: "item_3", icon: "icon_3"),
        MenuItem(title: "item_4", icon: "icon_4")
    ]

var body: some Scene {
    SSSwiftUISideMenu(openSideMenu: $openSideMenu, selectedIndex: $selectedIndex, menuItems: menuItems)
}

The results of any interaction from sidemenu item will available in declared selectedIndex state variable. Also sidemnu open / close toggle value will be available in the openSideMenu state variable.

Customizations

Change in Style


An example of customisation of styles


var body: some Scene {
    SSSwiftUISideMenu(openSideMenu: $openSideMenu, selectedIndex: $selectedIndex, menuItems: menuItems, 
        menuConfig: SSMenuConfig(titleColor: .black, 
                selectedTitleColor: .secondary, 
                backgroundColor: .white))
}

Change SideMenu direction - Left / Right


An example of change sidemenu direction. left direction is default


var body: some Scene {
    SSSwiftUISideMenu(openSideMenu: $openSideMenu, selectedIndex: $selectedIndex, menuItems: menuItems, 
        menuConfig: SSMenuConfig(menuDirection: .right))
}

Add animation to your sidemenu


An example of applying a animation type to the sidemenu


var body: some Scene {
    SSSwiftUISideMenu(openSideMenu: $openSideMenu, selectedIndex: $selectedIndex, menuItems: menuItems, 
        menuConfig: SSMenuConfig(animationType: .easeOut))
}

Other Customizations

SideMenu width


You can change the menu width of your choice with the menuWidth. By default is '280'.<br/>


var body: some Scene {
    SSSwiftUISideMenu(openSideMenu: $openSideMenu, selectedIndex: $selectedIndex, menuItems: menuItems, 
        menuConfig: SSMenuConfig(menuWidth: MENU_SIZE))
}

Icon color and customizations



var body: some Scene {
    SSSwiftUISideMenu(openSideMenu: $openSideMenu, selectedIndex: $selectedIndex, menuItems: menuItems, 
        menuConfig: SSMenuConfig(leftIconPadding: 20, 
                imageToTitlePadding: 15, 
                iconTintColor: .black, 
                iconHeight: 30, 
                iconWidth: 30))
}

Show App Version


An example of showing your app version at bottom of the sidemenu. you can configure its style and color. All are optionally configured.


var body: some Scene {
    SSSwiftUISideMenu(openSideMenu: $openSideMenu, selectedIndex: $selectedIndex, menuItems: menuItems, 
        menuConfig: SSMenuConfig(showAppVersion: true, 
                versionText: "1.0.0", 
                versionTitleColor: .gray, 
                versionAlignment: .center))
}

Coming Soon

Up for a suggestions. Give suggestions for more features and customisations.

🤝 How to Contribute

Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! :muscle:

Check out our Contributing Guide for ideas on contributing.

Find this example useful? ❤️

Give a ⭐️ if this project helped you!

Check out our other Libraries

<h3><a href="https://github.com/SimformSolutionsPvtLtd/Awesome-Mobile-Libraries"><u>🗂 Simform Solutions Libraries→</u></a></h3>

MIT License

This project is licensed under the MIT License - see the LICENSE file for details