andrewmarmion / AMCircleMenu

A animated button written in SwiftUI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AMCircleMenu

A SwiftUI implementation of ramotion's Circle Menu.

It dynamically positions the buttons on screen based on the number of buttons that you pass to it.

AMCircleButton.CircleMenu dark mode AMCircleButton.CircleMenu light mode AMCircleButton.VerticalCircleMenu light mode AMCircleButton.VerticalCircleMenu dark mode

Requirements

  • iOS 13.0 +
  • Xcode 11.0 +

Installation

Add the SPM package to your Xcode project at main

https://github.com/andrewmarmion/AMCircleMenu.git

Usage

import AMCircleMenu

Create your the buttons the you want to display

let button = AMCircleMenu.CircleItem(image: Image(systemName: "0.circle.fill"),
               color: .red,
               action: { print("Hello from 0")})

let buttons: [AMCircleMenu.CircleItem] = [...]

let centerButton = AMCircleMenu.CenterButton(image: Image(systemName: "headphones"), 
                                             color: .yellow)

For the expanding circle menu use the following:

AMCircleMenu.CircleMenu(centerButton: centerButton, 
                        circleItems: buttons)

For the vertical action menu use the following:

AMCircleMenu.VerticalMenu(centerButton: centerButton, circleItems: buttons)

Notes:

  • For the CircleMenu the maximum number of buttons that you can use is currently 10, the VerticalCircleMenu is limited by the height of the screen.
  • You cannot currently set the size of the buttons or the how far away they move out from the center button.

About

A animated button written in SwiftUI

License:MIT License


Languages

Language:Swift 100.0%