All Projects → lucacasula91 → Snackview

lucacasula91 / Snackview

Licence: apache-2.0
Customizable bottom-half alerts.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Snackview

Prometheus
A docker-compose stack for Prometheus monitoring
Stars: ✭ 3,383 (+1108.21%)
Mutual labels:  stack, alert
Awesome Ecommerce Stack
💰 Popular marketing tools and add-ons used by 10,000+ of the top e-commerce stores.
Stars: ✭ 255 (-8.93%)
Mutual labels:  stack
BalloonPopup
Forget Android Toast! BalloonPopup displays a round or squared popup and attaches it to a View, like a callout. Uses the Builder pattern for maximum ease. The popup can automatically hide and can persist when the value is updated.
Stars: ✭ 32 (-88.57%)
Mutual labels:  alert
Data-Structures-and-Algorithms
Data Structures and Algorithms implementation in Python
Stars: ✭ 31 (-88.93%)
Mutual labels:  stack
SBCardPopup
Card Popup UI for iOS
Stars: ✭ 66 (-76.43%)
Mutual labels:  viewcontroller
Swift
💻 Swift - Boilerplate Front : RxSwift, ReactorKit, JWT, Moya (Beta)
Stars: ✭ 17 (-93.93%)
Mutual labels:  stack
react-native-awesome-alert
🔔 Customizable modal components with ✔️check options in React Native
Stars: ✭ 50 (-82.14%)
Mutual labels:  alert
Javascript Datastructures Algorithms
📚 collection of JavaScript and TypeScript data structures and algorithms for education purposes. Source code bundle of JavaScript algorithms and data structures book
Stars: ✭ 3,221 (+1050.36%)
Mutual labels:  stack
checkmk-telegram-notify
Get alerted by Check_MK via Telegram bash script
Stars: ✭ 28 (-90%)
Mutual labels:  alert
Seriously
A golfing language that is probably terrible
Stars: ✭ 78 (-72.14%)
Mutual labels:  stack
geticon
Web / IT project stack / tool / technique icon / logo collection & markdown / HTML generator 🚀
Stars: ✭ 101 (-63.93%)
Mutual labels:  stack
Razor.SweetAlert2
A Razor class library for interacting with SweetAlert2
Stars: ✭ 98 (-65%)
Mutual labels:  alert
mean-stack-angular-8-blog-cms
MEAN Stack (Angular 8) Tutorial: Build a Simple Blog CMS Example
Stars: ✭ 19 (-93.21%)
Mutual labels:  stack
fp-tests
Haskell homework tests
Stars: ✭ 30 (-89.29%)
Mutual labels:  stack
Gostl
Data structure and algorithm library for go, designed to provide functions similar to C++ STL
Stars: ✭ 254 (-9.29%)
Mutual labels:  stack
maze-generator
A real-time JavaScript maze generator using the depth-first search algorithm
Stars: ✭ 13 (-95.36%)
Mutual labels:  stack
adif
用标准c语言开发的常用数据结构和算法基础库,作为应用程序开发接口基础库,为编写高性能程序提供便利,可极大地缩短软件项目的开发周期,提升工程开发效率,并确保软件系统运行的可靠性、稳定性。
Stars: ✭ 33 (-88.21%)
Mutual labels:  stack
Data-structures
Data Structures in Java
Stars: ✭ 13 (-95.36%)
Mutual labels:  stack
Rflutter alert
RFlutter Alert is super customizable and easy-to-use alert / popup dialog library for Flutter. You may create reusable alert styles or add buttons as much as you want with ease.
Stars: ✭ 271 (-3.21%)
Mutual labels:  alert
Devops Api
Golang + Beego 编写 提供开发/运维常用操作的HTTP API接口: 手机归属地查询、IP地址查询、工作日节假日判断、微信报警、钉钉报警、2步验证、密码存储、发送邮件、生成随机密码等功能
Stars: ✭ 258 (-7.86%)
Mutual labels:  alert

SnackView logo

SnackView

An easy way to present customizable bottom-half alert. SnackView logo

CocoaPods Compatible Carthage Compatible Platform License Downloads Twitter

Maintainability Test Coverage

What's new

What's new in 1.0.9

SnackView DataSource New SnackViewDataSource protocol with which create your SnackView.

SnackView NewItem New SVImageViewItem class with which display images.

  • Dark mode is not compatible yet, for now SnackView continue to show light UI.
  • Compatible with the new UIWindowSceneDelegate system.

What's new in 1.0.8

  • Fixed crash that occurs when SnackView was init with an empty SVItem array.

Installation

CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like SnackView in your projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.0.1+ is required to build SnackView 1+ (along with Swift 3 and Xcode 9).

Podfile

  • Swift 3.x: >= 1.0.1 Download here. To integrate SnackView into your Xcode project using CocoaPods, specify it in your Podfile:
use_frameworks!
pod 'SnackView', '~> 1.0.9'

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate SnackView into your Xcode project using Carthage, specify it in your Cartfile:

github "lucacasula91/SnackView"

SnackView 1.0.9 is not available yet on Carthage.

Manual installation

If you want to install SnackView manually, just drag SnackView Library folder into your project.

Usage

Create your custom SnackView alert

SnackView includes some default UI elements as Button, Label and other complex UI. The first step is to create an array of SVItem. SVItem is the class of every element that SnackView can include within it.

Here an example of simple SnackView alert:

class MyCustomClass: UIViewController {

    override func viewDidLoad() {  }

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)

        // Present the SnackView
        let dataSource = self
        SnackView(with: dataSource).show()
    }
}

// MARK: - SnackViewDataSource Section
extension MyCustomClass: SnackViewDataSource {

    func titleFor(snackView: SnackView) -> String {
        return "What's New"
    }

    func cancelTitleFor(snackView: SnackView) -> String? {
        return "Dismiss"
    }

    func itemsFor(snackView: SnackView) -> [SVItem] {
        let descriptionItem = SVDescriptionItem(withDescription: "In this last release of SnackView we...")
        let imageItem = SVImageViewItem(withImage: UIImage(named: "hat_is_new")!,
                                        andContentMode: .scaleAspectFill)

        return [descriptionItem, imageItem]
    }
}


Deprecated methods

With SnackView 1.0.9 the current method are now deprecated:

  • init(withTitleOptions: andItems:)
  • init(withTitle: andCloseButtonTitle: andItems:)

SnackViewDataSource contains all you need to handle title, cancel button title and items to display. For more info please see the SnackViewDataSource protocol documentation code.

  • func insert(item: atIndex:)
  • func remove(item:)
  • func removeItemAt(index:)
  • func updateWith(items:)

Please start using the new SnackViewDataSource instead, all the above operations can be performed simply by changing the return content in the func itemsFor(snackView:) method of SnackViewDataSource and call the reloadData() function to perform an update.


SVItems included

SnackView provides some SVItems ready to use, here below the list of SVItems available:

SVApplicationItem

SVApplicationItem(withIcon: UIImage(named: "AppIcon"),
                 withTitle: "Ipsum lorem", 
            andDescription: "Lorem ipsum dolor sit amet...")

SnackView alert


SVDescriptionItem

SVDescriptionItem(withDescription: "Lorem ipsum dolor sit amet...")

SnackView alert


SVTextFieldItem

SVTextFieldItem(withPlaceholder: "Create Password", 
                  isSecureField: true)

SnackView alert


SVDetailTextItem

SVDetailTextItem(withTitle: "Elit amet", 
                andContent: "Lorem ipsum dolor sit amet...")

SnackView alert


SVButtonItem

SVButtonItem(withTitle: "Continue") { /* Button action here */ }

SnackView alert


SVSwitchItem

SVSwitchItem(withTitle: "Push Notifications", 
            andContent: "Activate to stay up to date...") { (isOn) in  /* Switch action here */ }

SnackView alert


SVLoaderItem

SVLoadingItem(withSize: .large, 
               andText: "Lorem ipsum dolor sit amet...")

SnackView alert Item


SVImaveViewItem

SVImageViewItem(with: UIImage(named: "hat_is_new")!,
                              andContentMode: .scaleAspectFill)

SnackView alert Item


Create custom SVItems

You can create custom items subclassing SVItem class.

Here below an example.

import UIKit
import SnackView

//Create a subclass of SVItem
class SVCustomItem: SVItem {
    
    //Pass all parameters in init method to customize your SVItem
    init(withColor color: UIColor) {
        super.init()
        
        //Add an UIView
        let customView = UIView()
        customView.translatesAutoresizingMaskIntoConstraints = false
        customView.backgroundColor = color
        self.addSubview(customView)
       
        //Add UIView contraints
         let vConstraints = NSLayoutConstraint.constraints(withVisualFormat: "V:|-[customView(70)]-|", options: [], metrics: nil, views: ["customView":customView])
        
        let hConstraints = NSLayoutConstraint.constraints(withVisualFormat: "H:|-[customView]-|", options: [], metrics: nil, views: ["customView": customView])
        
        self.addConstraints(vConstraints + hConstraints)
    }
    
    required public convenience init?(coder aDecoder: NSCoder) {
        self.init(coder: aDecoder)
    }
}

Custom SVItem


Contributing

If you want to contribute to make SnackView a better framework, submit a pull request.

Please consider to open an issue for the following reasons:

  • If you have questions or if you need help using SnackView
  • If you found a bug
  • If you have some feature request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].