ProductPromotion
Logo

Swift

made by https://0x3d.site

GitHub - exyte/FloatingButton: Easily customizable floating button menu created with SwiftUI
Easily customizable floating button menu created with SwiftUI - exyte/FloatingButton
Visit Site

GitHub - exyte/FloatingButton: Easily customizable floating button menu created with SwiftUI

GitHub - exyte/FloatingButton: Easily customizable floating button menu created with SwiftUI

     

SPM Compatible Cocoapods Compatible Carthage Compatible License: MIT

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. You may also pass a binding which will determine if the menu is currently open. You may use this to close the menu on any submenu button tap for example.

FloatingButton(mainButtonView: mainButton, buttons: buttons, isOpen: $isOpen)
  1. Chain .straight() or .circle() to specify desired menu type.
  2. 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)
        .layoutDirection(.counterClockwise)
    

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 - you can pass array of delays - one for each element - or you can pass delayDelta - then this same delay will be used for each element mainZStackAlignment - main button and submenu buttons are contained in one ZStack (not an overlay so the menu has a correct size), you can change this ZStack's alignment with this parameter inverseZIndex - inverse zIndex of mainButton and the children. Use, for example, if you have a negative spacing and want to change the order wholeMenuSize - pass CGSize binding to get updates of menu's size. Menu's size includes main button frame and all of elements' frames menuButtonsSize - pass CGSize binding to get updates of combined menu elements' size

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 - distance between center of main button and centers of submenu buttons
layoutDirection - changes the button layout direction from the startAngle to the endAngle

Examples

To try out the FloatingButton examples:

  1. Clone the repo git clone [email protected]:exyte/FloatingButton.git.
  2. Open <FloatingButtonRepo>/Example.
  3. Run Example.xcodeproj - framework is imported as a local SPM package.
  4. Try it!

Installation

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/exyte/FloatingButton.git")
]

CocoaPods

pod 'FloatingButton'

Carthage

github "Exyte/FloatingButton"

Requirements

  • iOS 14.0+ / macOS 11.0+ / watchOS 7.0+
  • Xcode 12+

Our other open source SwiftUI libraries

PopupView - Toasts and popups library
Grid - The most powerful Grid container
ScalingHeaderScrollView - A scroll view with a sticky header which shrinks as you scroll
AnimatedTabBar - A tabbar with a number of preset animations
MediaPicker - Customizable media picker
Chat - Chat UI framework with fully customizable message cells, input view, and a built-in media picker
OpenAI Wrapper lib for OpenAI REST API
AnimatedGradient - Animated linear gradient
ConcentricOnboarding - Animated onboarding flow
ActivityIndicatorView - A number of animated loading indicators
ProgressIndicatorView - A number of animated progress indicators
FlagAndCountryCode - Phone codes and flags for every country
SVGView - SVG parser
LiquidSwipe - Liquid navigation animation

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory