LiulietLee / LLDialog

Material design dialog for iOS written in Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LLDialog

Material design dialog for iOS written in Swift.

Installation

pod 'LLDialog', :git => 'https://github.com/LiulietLee/LLDialog.git'

or just move Source/LLDialog.swift to your project.

Usage

You can see a simple example by downloading this project.

Construct with Builder

LLDialog()
// Set title. (Optional, but recommended)
.set(title: "Use Google's location service?")

// Set message. (Optional, but recommended)
.set(message: "Let Google help apps determine location. This means sending anonymous location data to Google, even when no apps are running.")

// Set the buttons.
.setPositiveButton(withTitle: "AGREE", target: self, action: #selector(<#tappedPositiveButton#>))
.setNegativeButton(withTitle: "DISAGREE", target: self, action: #selector(<#tappedNegativeButton#>))

// At last, show the dialog.
.show()
// Or, especially if targeting extensions, show in a parent view.
.show(in: <#T##parent UIView##UIView#>)

Or Convenience Initialzier

LLDialog(
    title: "Unapplied method reference",
    message: "It produces better indentation. Maybe not after SE-0042.",
    positiveButton: .init(
        title: "", // Title for positive button is required. Blank is the same as "OK".
        onTouchUpInside: (target: self,
                          action: #selector(<#tappedPositiveButton#>))),
    negativeButton: .init(
        title: "What?",
        onTouchUpInside: (target: self,
                          action: #selector(<#tappedNegativeButton#>)))
).show()

TO DO

  • The animation after tapping the button.

About

Material design dialog for iOS written in Swift.

License:MIT License


Languages

Language:Swift 91.8%Language:Ruby 8.2%