We are a development agency building phenomenal apps.
-
Create main button view and a number of submenu buttons — both should be cast to
AnyView
type. -
Pass both to
FloatingButton
constructor:FloatingButton(mainButtonView: mainButton, buttons: buttons)
-
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)
- Chain
.straight()
or.circle()
to specify desired menu type. - 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)
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
direction
- position of submenu buttons relative to main menu button
alignment
- alignment of submenu buttons relative to main menu button
startAngle
endAngle
radius
To try out the FloatingButton examples:
- Clone the repo
git clone git@github.com:exyte/FloatingButton.git
. - Open terminal and run
cd <FloatingButtonRepo>/Example
. - Run
pod install
to install all dependencies. - Run
xed .
to open project in the Xcode. - Try it!
dependencies: [
.package(url: "https://github.com/exyte/FloatingButton.git")
]
pod 'FloatingButton'
github "Exyte/FloatingButton"
- iOS 13+ / watchOS 13+ / tvOS 13+ / macOS 10.15+
- Xcode 11+
PopupView - Toasts and popups library
Grid - The most powerful Grid container
ScalingHeaderScrollView - A scroll view with a sticky header which shrinks as you scroll.
MediaPicker - Customizable media picker
ConcentricOnboarding - Animated onboarding flow
ActivityIndicatorView - A number of animated loading indicators
ProgressIndicatorView - A number of animated progress indicators
SVGView - SVG parser
LiquidSwipe - Liquid navigation animation