GithubHelp home page GithubHelp logo

wjnhub / drops Goto Github PK

View Code? Open in Web Editor NEW

This project forked from omaralbeik/drops

0.0 0.0 0.0 11.05 MB

A µFramework for showing alerts like the one used when copying from pasteboard or connecting Apple pencil

Home Page: https://omaralbeik.github.io/Drops

License: MIT License

Shell 0.14% Ruby 0.98% Swift 98.88%

drops's Introduction

Drops 💧

A µFramework for showing alerts like the one used when copying from pasteboard or connecting Apple pencil.

Demo


CI codecov

Features

  • iOS 13+
  • Can be used in SwiftUI and UIKit applications
  • Light/Dark modes
  • Interactive dismissal
  • Queue to show consecutive drops
  • Support dynamic font sizing
  • Support announcing title and subtitle via VoiceOver
  • Show from top or bottom of screen

Usage

  1. Create a drop:
let drop: Drop = "Title Only"
let drop = Drop(title: "Title Only")
let drop = Drop(title: "Title", subtitle: "Subtitle")
let drop = Drop(title: "Title", subtitle: "Subtitle", duration: 5.0)
let drop = Drop(
    title: "Title",
    subtitle: "Subtitle",
    icon: UIImage(systemName: "star.fill"),
    action: .init {
        print("Drop tapped")
        Drops.hideCurrent()
    },
    position: .bottom,
    duration: 5.0,
    accessibility: "Alert: Title, Subtitle"
)
  1. Show it:
Drops.show("Title")
Drops.show(drop)
SwiftUI
import SwiftUI
import Drops

struct ContentView: View {
    var body: some View {
        Button("Show Drop") {
            Drops.show(drop)
        }
    }
}
UIKit
import UIKit
import Drops

class ViewController: UIViewController {
    let drops = Drops(delayBetweenDrops: 1.0)

    func showDrop() {
        drops.show(drop)
    }
}

Read the docs for more usage options.


Example Projects

  • Run the SwiftUIExample target to see how Drops works in SwiftUI applications.
  • Run the UIKitExample target to see how Drops works in UIKit applications.

Example


Installation

Swift Package Manager

The Swift Package Manager is a tool for managing the distribution of Swift code.

  1. Add the following to your Package.swift file:
dependencies: [
    .package(url: "https://github.com/omaralbeik/Drops.git", from: "1.6.0")
]
  1. Build your project:
$ swift build

CocoaPods

To integrate Drops into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'Drops', :git => 'https://github.com/omaralbeik/Drops.git', :tag => '1.6.0'

Carthage

To integrate Drops into your Xcode project using Carthage, specify it in your Cartfile:

github "omaralbeik/Drops" ~> 1.6.0

Manually

Add the Sources folder to your Xcode project.


Thanks

Special thanks to SwiftKickMobile team for creating SwiftMessages, this project was heavily inspired by their work.


License

Drops is released under the MIT license. See LICENSE for more information.

drops's People

Contributors

1998code avatar ky1vstar avatar maiyama18 avatar mustafagunes avatar omaralbeik avatar sbertix avatar thierrybucco avatar tthbalazs 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.