Coder Social home page Coder Social logo

bauletto's Introduction

Bauletto

Swift Package Manager iOS Twitter: @gianpispi

Lightweight iOS 13 badge like with ease.

Preview

Bauletto

Features

  • Highly customizable ✅
  • iPhone, iPhone X, & iPad Support ✅
  • Orientation change support ✅
  • Haptic feeback support ✅

Requirements

  • iOS 10.0+
  • Xcode 10.0+

Installation

Carthage

In order to use Bauletto via Carthage simply add this line to your Cartfile:

Swift 5

github "gianpispi/Bauletto"

Then add Bauletto.framework in your project.

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding Bauletto as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
.package(url: "https://github.com/gianpispi/Bauletto.git", from: "1.0.0")
]

Usage

Creating a Bauletto is simple as this:

let settings = BaulettoSettings(icon: UIImage(systemName: "checkmark.seal.fill", withConfiguration: UIImage.SymbolConfiguration(weight: .semibold)), title: "It works")
Bauletto.show(withSettings: settings)

If you want to change the tint color of the Bauletto, just use the tintColor value in the BaulettoSettings declaration as follows:

let settings = BaulettoSettings(icon: UIImage(systemName: "checkmark.seal.fill", withConfiguration: UIImage.SymbolConfiguration(weight: .semibold)), title: "It works", tintColor: .red)
Bauletto.show(withSettings: settings)

To change the background blur effect, add the backgroundStyle:

let settings = BaulettoSettings(icon: UIImage(systemName: "checkmark.seal.fill", withConfiguration: UIImage.SymbolConfiguration(weight: .semibold)), title: "It works", backgroundStyle: .dark)
Bauletto.show(withSettings: settings)

You can even change the dismissMode, which can be .never, automatic or .custom(seconds: 2). By default it uses the automatic.

let settings = BaulettoSettings(icon: UIImage(systemName: "checkmark.seal.fill", withConfiguration: UIImage.SymbolConfiguration(weight: .semibold)), title: "It works", dismissMode: .never)
Bauletto.show(withSettings: settings)

Bauletto has a personal queue for the banners that will show up. When you show a banner you can select where in the queue it will be put. By default it is .end.

public enum QueuePosition {
	case beginning, end
}

Bauletto.show(withSettings: settings, queuePosition: .beginning)

When you want to show up a new message immediately, add it by using the show() function, and then use:

Bauletto.shared.forceShowNext()

Do you have a bunch of settings in the queue and you want to remove them? No problem.

Bauletto.shared.removeBannersInQueue()

Haptic Feedback Support

You can also set a haptic feedback when the Bauletto shows up. By default, no haptic feedback will be generated. The types of haptic feedback are as follows:

public enum HapticStyle {
    case notificationError
    case notificationWarning
    case notificationSuccess
    
    case light
    case medium
    case heavy
    case none
    
    case soft
    case rigid
}

To change the style of haptic feedback, simply declare it in the BaulettoSettings initialization:

let settings = BaulettoSettings(icon: UIImage(systemName: "checkmark.seal.fill"), title: "It works", backgroundStyle: .systemChromeMaterial, dismissMode: .automatic, hapticStyle: .notificationSuccess)

Feature Requests

I'd love to know improve Bauletto as much as I can. Feel free to open an issue and I'll do everything I can to accomodate that request if it is in the library's best interest. Or just create a pull request and I'll check it out.

Author

Gianpiero Spinelli, [email protected]

License

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

bauletto's People

Contributors

gianpispi avatar

Watchers

 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.