Skip to content
Easily customizable floating button menu created with SwiftUI
Swift Ruby Objective-C
Branch: master
Clone or download
Latest commit 70d4f63 Jan 31, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Assets Initial commit Dec 27, 2019
Example Initial commit Dec 27, 2019
FloatingButton.xcodeproj Initial commit Dec 27, 2019
Source Initial commit Dec 27, 2019
.gitignore Add .gitignore Dec 26, 2019
.travis.yml Initial commit Dec 27, 2019
FloatingButton.podspec Initial commit Dec 27, 2019
LICENSE Initial commit Dec 27, 2019
Package.swift Initial commit Dec 27, 2019
README.md Update README.md Jan 31, 2020

README.md

FloatingButton

Easily customizable floating button menu created with SwiftUI


We are a development agency building phenomenal apps.




Travis CI Version Carthage Compatible License Platform Twitter

Usage

  1. Create main button view and a number of submenu buttons — both should be cast to AnyView type.

  2. Pass both to FloatingButton constructor:

    FloatingButton(mainButtonView: mainButton, buttons: buttons)
  3. Chain .straight() or .circle() to specify desired menu type.

  4. Chain whatever you like afterwards. For example:

    FloatingButton(mainButtonView: mainButton, buttons: textButtons)
        .straight()
        .direction(.top)
        .alignment(.left)
        .spacing(10)
        .initialOffset(x: -1000)
        .animation(.spring())
    
    FloatingButton(mainButtonView: mainButton2, buttons: buttonsImage.dropLast())
        .circle()
        .startAngle(3/2 * .pi)
        .endAngle(2 * .pi)
        .radius(70)

Universal options

spacing - space between submenu buttons
initialScaling - size multiplyer for submenu buttons when the menu is closed
initialOffset - offset for submenu buttons when the menu is closed
initialOpacity - opacity for submenu buttons when the menu is closed
animation - custom SwiftUI animation like Animation.easeInOut() or Animation.spring()
delays - delay for each submenu button's animation start

Straight menu only options

direction - position of submenu buttons relative to main menu button
alignment - alignment of submenu buttons relative to main menu button

Circle only options

startAngle
endAngle
radius

Examples

To try out the FloatingButton examples:

  1. Clone the repo git clone git@github.com:exyte/FloatingButton.git.
  2. Open terminal and run cd <FloatingButtonRepo>/Example.
  3. Run pod install to install all dependencies.
  4. Run xed . to open project in the Xcode.
  5. Try it!

Installation

CocoaPods

pod 'FloatingButton'

Carthage

github "Exyte/FloatingButton"

Manually

Drop FloatingButton.swift into your project.

Requirements

  • iOS 13+ / watchOS 13+ / tvOS 13+ / macOS 10.15+
  • Xcode 11+
You can’t perform that action at this time.