Latest 1.0.0
Homepage https://github.com/quanghoang0101/HPFloatMenu
License MIT
Platforms ios 9.0
Dependencies SnapKit
Authors

Platform
Language
Version
License
Issues
Build
codecov

HPFloatMenu with cool animation for your iOS app, easy setup and use!

sample

Installation

CocoaPods

pod 'HPFloatMenu'

Manually

Copy the HPFloatMenu folder to your project.

Customization

HPFloatMenuView Customizable

  • speed of animation
    var animationSpeed: Double = 0.1
  • space of each item in the menu
    var spacingItem: CGFloat = 15.0
  • position of the menu
    var position: MenuPosition = .bottomLeft
  • overlay color
    var colorOverlay: UIColor = UIColor(white: 0, alpha: 0.5)
  • radial gradient color
    var radialGradientColors: [UIColor]

    FloatMenuItem Customizable

  • configation for item

    public struct ItemConfigation {
    
    public var colorTitle: UIColor!
    public var colorIcon: UIColor!
    public var fontTitle: UIFont!
    public var iconSize: CGFloat!
    }
  • init item with title and icon

    init(with title: String, icon: UIImage)
  • init item with title, icon and custom configation

    init(with title: String, icon: UIImage, config: ItemConfigation)
  • init item with title and configation
    init(with title: String, config: ItemConfigation) 

    Monitor the states of menu, you can use FloatMenuDelegate use this:

    func floatMenuDidOpen(_ menu: FloatMenuView)
    func floatMenuDidClose(_ menu: FloatMenuView)
    func floatMenuDidSelectItem(_ menu: FloatMenuView, at index: Int)

Usage

Setup

Add import HPFloatMenu in your file

lazy var floatMenuView: FloatMenuView = {
    let view = FloatMenuView(frame: .zero)
    view.delegate = self
    return view
}()

func setDefaultItems() {
   let group = FloatMenuItem(with: "Group", config: ItemConfigation(colorIcon: UIColor(hexString: "#CFCFCF")!))
   self.floatMenuView.addItem(group)

   let watch = FloatMenuItem(with: "Watch", config: ItemConfigation(colorIcon: UIColor(hexString: "#969696")!))
   self.floatMenuView.addItem(watch)

   let settings = FloatMenuItem(with: "Settings", config: ItemConfigation(colorIcon: UIColor(hexString: "#6D6C6C")!))
   self.floatMenuView.addItem(settings)
}

override func viewDidLoad() {
   super.viewDidLoad()
   self.setDefaultItems()
   self.floatMenuView.radialGradientColors = [UIColor(hexString: "#2E2E2E")!.withAlphaComponent(0.9), UIColor(hexString: "#383838")!]
}

@objc private func showMenu(_ sender: Any) {
   self.floatMenuView.showMenu(at: sender as! UIButton)
}

extension ViewController: FloatMenuDelegate {
    func floatMenuDidOpen(_ menu: FloatMenuView) {
        print("FLoat menu did openn")
    }

    func floatMenuDidClose(_ menu: FloatMenuView) {
        print("Float menu did closen")
    }

    func floatMenuDidSelectItem(_ menu: FloatMenuView, at index: Int) {
        print("Did select item at index (index)n")
        menu.dimissItems()
    }
}

Requirements

Swift 5.0

iOS 9.0+

Contributing

Forks, patches and other feedback are welcome.

Creator

HPFloatMenu

Quang Hoang

Blog

License

HPFloatMenu is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "HPFloatMenu",
    "version": "1.0.0",
    "summary": "HPFloatMenu with cool animation for your iOS app, easy setup and use!",
    "description": "A library for floating menu, user can easy custom the menu with icons and text.",
    "homepage": "https://github.com/quanghoang0101/HPFloatMenu",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Hoang": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/quanghoang0101/HPFloatMenu.git",
        "tag": "1.0.0"
    },
    "source_files": "HPFloatMenu/**/*.{swift}",
    "dependencies": {
        "SnapKit": [
            "4.2.0"
        ]
    },
    "swift_version": "5"
}

Pin It on Pinterest

Share This