Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<true/>
</dict>
</plist>
66 changes: 66 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/SideMenu.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SideMenu"
BuildableName = "SideMenu"
BlueprintName = "SideMenu"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SideMenu"
BuildableName = "SideMenu"
BlueprintName = "SideMenu"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
113 changes: 0 additions & 113 deletions HomeView.swift

This file was deleted.

8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import PackageDescription

let package = Package(
name: "SideMenu",
name: "iosSwiftUISideMenu",
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "SideMenu",
targets: ["SideMenu"]),
name: "iosSwiftUISideMenu",
targets: ["iosSwiftUISideMenu"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
Expand All @@ -19,7 +19,7 @@ let package = Package(
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "SideMenu",
name: "iosSwiftUISideMenu",
dependencies: [],
path: "Sources", resources: [
.process("Resources/Media.xcassets")
Expand Down
130 changes: 98 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,117 @@
# SideMenu - SwiftUI
# iOS SwiftUI SideMenu 📱

## Install
[![Swift Version](https://img.shields.io/badge/swift-5.0-orange.svg)](https://swift.org/)
[![Platform](https://img.shields.io/badge/platform-ios-lightgrey.svg)](https://developer.apple.com/ios/)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

## Preview 🖼️

![Preview Image 1](https://github.com/xartistax/xArtistaxSideMenu/assets/119945844/025ee141-80cc-4cbf-ae14-097690635189)
![Preview Image 2](https://github.com/xartistax/xArtistaxSideMenu/assets/119945844/743e8cfc-af48-49ed-9c62-ccf52693d176)


iosSwiftUISideMenu is an intuitive SwiftUI package designed to streamline navigation and enhance user experience within your iOS applications. 📱✨

### Swift Package Manager

Open `Xcode`, go to `File -> Swift Packages -> Add Package Dependency` and enter `https://github.com/akardas16/SideMenu.git` as Branch `main`
## Features 🌟

You need to add `import SideMenu`
- **Effortless Navigation:** Seamlessly navigate through different views and sections with a user-friendly side menu.
- **Customizable Interface:** Tailor the menu appearance, animations, and functionalities to match your app's aesthetics and requirements.
- **SwiftUI Integration:** Leverage the power of SwiftUI for a smooth and native integration within your iOS app.



## Installation 🛠️

### Swift Package Manager

## Usage
Without 3D effect<img src="https://user-images.githubusercontent.com/28716129/185779303-b833211b-07e0-4bc5-b01a-723352ccf49b.gif" width="25%" >
With 3D effect<img src="https://user-images.githubusercontent.com/28716129/185779405-1de7d9da-36fe-4aee-a3a5-13e67b9cf566.gif" width="25%" >
1. Open `Xcode`.
2. Go to `File -> Swift Packages -> Add Package Dependency`.
3. Enter `https://github.com/xartistax/iosSwiftUISideMenu.git` as Branch `main`.
4. Import the package using `import iosSwiftUISideMenu`.

* initilize `SideMenuView` with available parameters
## Usage 🚀

Initialize `SideMenuView` with the available parameters:


```Swift
SideMenuView(
isMenuOpen: $isMenuOpen,
tabs: tabs, // add your [MenuTabModel]
selectedTab: $selectedTab, //initial selectedTab
backColor: $backColor, //acces view placeholder background
backImage: "airplane", //add your background image! Default value is airplane
selectionColor: .purple,
blurRadius: 32, // add blur radius for image default value is 32
enable3D: true //enable/disable 3D effect
) {
if selectedTab.title == "Home" {
TabOne(isMenuOpen: $isMenuOpen, backColor: $backColor)
}else if selectedTab.title == "Profile" {
TabTwo(isMenuOpen: $isMenuOpen, backColor: $backColor)
}else if selectedTab.title == "Settings" {
TabThree(isMenuOpen: $isMenuOpen, backColor: $backColor)

struct ContentView: View, TabItemView {

@State private var isMenuOpen: Bool = true
@State private var selectedTab: MenuTabModel?

var tabs: [MenuTabModel] {
return [

MenuTabModel(
title: "SubView",
subtitle: nil,
imageName: "lock",
view: SubView(isMenuOpen: $isMenuOpen))

]

}

var body: some View {


SideMenuView (
isMenuOpen: $isMenuOpen,
selectedTab: $selectedTab,
selectedMenuView: .roundIcons,
rootView: RootView(isMenuOpen: $isMenuOpen),
tabs: tabs
)
}
}

```

* Example tabs array
## Available Parameters

```Swift
let tabs = [MenuTabModel(title: "Home", imageName: "house"),MenuTabModel(title: "Profile", imageName: "person"),MenuTabModel( title: "Settings", imageName: "gear")]
SideMenuView (
isMenuOpen: <#T##Binding<Bool>#>,
selectedTab: <#T##Binding<MenuTabModel?>#>,
offset: <#T##CGFloat#>,
menuOverlayOpacity: <#T##CGFloat#>,
blurRadius: <#T##CGFloat#>,
enable3D: <#T##Bool#>,
backImage: <#T##String#>,
iconColor: <#T##Color#>,
iconBg: <#T##Color#>,
bgColor: <#T##Color#>,
selectionColor: <#T##Color#>,
menuOverlayColor: <#T##Color#>,
avatar: <#T##AvatarView?#>,
selectedMenuView: <#T##MenuViewType#>,
rootView: <#T##RootView#>,
tabs: <#T##[MenuTabModel]#>
)

```

## SubViews

```Swift
@State var isMenuOpen:Bool = true
@State var selectedTab:MenuTabModel = MenuTabModel(title: "Home", imageName: "house")
@State var backColor = Color.pink
struct SubView: View , TabItemView {

@Binding var isMenuOpen: Bool

var body: some View {
VStack {
Text("SubView")
Button(action: {
isMenuOpen.toggle()
}, label: {
Text("Close Button")
})
}
}
}
```
### Want to try library quickly?
* Paste `HomeView.swift` file to your project and see UI on preview


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "airplane.png",
"filename" : "Avatar.jpg",
"idiom" : "universal",
"scale" : "1x"
},
Expand Down
Binary file not shown.
21 changes: 21 additions & 0 deletions Sources/Resources/Media.xcassets/menuBG.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "mainBG.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading