Giter VIP home page Giter VIP logo

alertviewlibrary's Introduction

AlertViewLibrary

Compatibility

  • iOS 11 and higher
  • MacOS 10.15 and higher

Installation

Add AlertViewLibrary Package Dependency to your project

Screenshot 2023-12-25 at 03 03 42



Screenshot 2023-12-25 at 03 04 25

Usage

Initialization

Import Library

import AlertViewLibrary

Initialize Library

lazy var alert:AlertManager = .init()

// performs instantialization of UIView from xib

Done! And now you can use the Library

Basic Usage Examples

Show Loading indicator

alert.showLoading(description: "Your loading description")

// Adds self (UIView) to UIWindow of active UIScene

Show Alert

alert.showAlert(title: "Your Title", description: "Your Description", appearence: .with({
    $0.image = .image(.init(named: "screen1")!)
}))

// Adds self (UIView) to UIWindow of active UIScene

Alert Types

error.mp4
alert.showAlert(title: nil, appearence: .type(.error))

appearence: Declared in https://github.com/mishadovhiy/AlertViewLibrary/blob/main/Sources/AlertViewLibrary/AlertViewLibrary/Extensions_AlertViewLibrary.swift#L74

ViewType

primary types:

  • error
  • standard (default)
  • succsess

Note: .error and .success types are setting default title (when alert title is nill) and default image
default image or title can be setted when initializing AlertManager

To Show error or success without default image, set

alert.showAlert(title: nil, appearence: .with({
    $0.type = .error
    $0.image = AlertViewLibrary.AIImage.none
}))

And you can set primary and secondary button (with type, title and completion handler) if primaryButton or secondaryButton is not initialized in showAlert method - would be displayed single ok button that hides an alert (default ok title text could be setted when initializing the Library)

Customization

customAlert

AlertManager.init(appearence:.with({
    $0.colors = .with({
        $0.alertState = .with({
            $0.view = blue
            $0.background = .black.withAlphaComponent(0.5)
        })
        $0.activityState = .with({
            $0.view = orange.withAlphaComponent(0.8)
            $0.background = .black.withAlphaComponent(0.1)
        })
        $0.texts = .with({
            $0.title = .black
            $0.description = .black.withAlphaComponent(0.5)
        })
        $0.buttom = .with({
            $0.link = .black
            $0.normal = .gray
        })
    })
    $0.animations = .with({
        $0.setBackground = 0.8
        $0.alertShow = 0.5
        $0.performHide1 = 0.5
        $0.performHide2 = 0.3
        $0.loadingShow1 = 0.4
        $0.loadingShow2 = 0.5
    })
    $0.images = .with({
        $0.alertError = nil
        $0.alertSuccess = nil
    })
}))

Appearence declaration: https://github.com/mishadovhiy/AlertViewLibrary/blob/main/Sources/AlertViewLibrary/Model/AIAppearence.swift#L10

All parameters are optional

Features

  • Manages unseen alerts When Alert View is presenting - all new alerts would be added to the query and would be presented later
  • Customize animation, default texts, default images, colors, layer (corner radius, etc)

Usage example in apps




Created by Misha Dovhiy

alertviewlibrary's People

Contributors

m-dovhyi-engenious avatar mishadovhiy 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.