GithubHelp home page GithubHelp logo

abdulrahman-khursheed / hover Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pedrommcarrasco/hover

0.0 0.0 0.0 12.05 MB

🎈 The smartest floating button

License: MIT License

Swift 96.87% Ruby 3.13%

hover's Introduction

Presentation

🎈 What's Hover?

Hover (/ˈhΙ’v.Ι™r/), verb

"to stay in one place in the air"

Hover is a draggable floating action button (FAB) inspired by Apple's session Designing Fluid Interfaces & Nathan Gitter's fluid-interfaces. Hover will always stick to the nearest corner to avoid blocking content and allows the user to send it to any other corner with a single swipe.

CocoaPods Carthage compatible apm

πŸ“¦ Installation

CocoaPods

Add the following line to your podfile:

pod 'Hover'

And then run the following command in terminal:

pod install

Carthage

Add the following line to your cartfile:

github "pedrommcarrasco/Hover"

And then run the following command in terminal:

carthage update

Swift Package Manager

To include Hover into a Swift Package Manager package, add it to the dependencies attribute defined in your Package.swift file. For example:

    dependencies: [
        .package(url: "https://github.com/pedrommcarrasco/Hover.git", from: <version>),
    ]

⌨️ Usage Example

After installing Hover, you should start by importing the framework:

import Hover

Once imported, you can start using Hover like follows:

// Create Hover's Configuration (all parameters have defaults)
let configuration = HoverConfiguration(icon: UIImage(named: "add"), color: .gradient(top: .blue, bottom: .cyan))

// Create the items to display
let items = [
    HoverItem(title: "Drop it Anywhere", image: UIImage(named: "anywhere")) { print("Tapped 'Drop it anywhere'") },
    HoverItem(title: "Gesture Driven", image: UIImage(named: "gesture")) { print("Tapped 'Gesture driven'") },
    HoverItem(title: "Give it a Star", image: UIImage(named: "star")) { print("Tapped 'Give it a star'") }
]

// Create an HoverView with the previous configuration & items
let hoverView = HoverView(with: configuration, items: items)

// Add to the top of the view hierarchy
view.addSubview(hoverView)
hoverView.translatesAutoresizingMaskIntoConstraints = false

// Apply Constraints
// Never constrain to the safe area as Hover takes care of that
NSLayoutConstraint.activate(
    [
        hoverView.topAnchor.constraint(equalTo: view.topAnchor),
        hoverView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
        hoverView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
        hoverView.trailingAnchor.constraint(equalTo: view.trailingAnchor)
    ]
)

For more details about all the parameters that you can configure, take a look into HoverConfiguration.swift.

πŸ“² Sample Project

There's a sample project in this repository with some samples of Hover called Example.

❀️ Support Hover

Hello there πŸ‘‹

I’m Pedro, a Portuguese iOS Engineer since February 2017. I’m an avid OSS enthusiast and contributor - help by sharing, learn by what’s shared.

I've built and open-sourced multiple frameworks and applications, including Brooklyn and CocoaHub.

I'm also a conference and meetup organizer, being part of SwiftAveiro and CocoaHeads Porto.

If you enjoy my work and would like to help me continue it, please consider:

πŸ™Œ Contributing

Feel free to contribute to this project by reporting bugs or open pull requests.

Hover was created for personal use but dynamic enough to be an open-source framework. As such, while functional, it may lack some additional customization. If there's something missing that you need, feel free to ask me here or on Twitter.

β›” License

Hover's available under the MIT license. See the LICENSE file for more information.

hover's People

Contributors

pedrommcarrasco avatar alspirichev avatar ftp27 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.