incetro-alert 1.1.1

incetro-alert 1.1.1

Maintained by incetro, Alexander Lezya.



  • By
  • incetro

Placeholder

Build Status CocoaPods Carthage Compatible GitHub license Platforms

Message is a framework written in Swift that makes it easy for you to show your informational messages

Features

  • Standard alert with text fields and buttons
  • Standard action sheet with buttons
  • Delegation
  • Dropdown message

Usage

Simple Alert

Alert(withTitle: "Title", message: "Your message").addTextField { textField in
                
    textField.placeholder = "Placeholder"
}
            
.addButton(withTitle: "Ok")
            
.addCancelButton(withTitle: "Close")
            
.show()

Simple ActionSheet

ActionSheet(withTitle: "Title", message: "Your message")
            
.addButton(withTitle: "Ok")
            
.addCancelButton(withTitle: "Cancel")
            
.addDestructiveButton(withTitle: "Destructive")
            
.show()

Using delegate

class ViewController: UIViewController {

    override func viewDidLoad() {
        
        super.viewDidLoad()
        
        Alert(withTitle: "Title", message: "Your message").addTextField { textField in
                
            textField.placeholder = "Placeholder"
        }
            
        .addButton(withTitle: "Ok")
            
        .addCancelButton(withTitle: "Close")
            
        .show(withDelegate: self)
    }
}

extension ViewController: AlertDelegate {
    
    func willShow(_ alert: AlertProtocol) {
           
    }
    
    func didShow(_ alert: AlertProtocol) {
        
    }
    
    func willDisappear(_ alert: AlertProtocol) {
        
    }
    
    func didDisappear(_ alert: AlertProtocol) {
        
    }
}

Advanced usage

Alert(withMessage: "Message").addButton(withTitle: "Ok").show(after: 1.0)
        
Alert(withMessage: "Message").show(andCloseAfter: 2.0)
        
Alert(withMessage: "Message").show(after: 1.0, andCloseAfter: 2.0)

Requirements

  • iOS 8.0+
  • Xcode 8.1, 8.2, 8.3, and 9.0
  • Swift 3.0, 3.1, 3.2, and 4.0

Communication

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

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

use_frameworks!

target "<Your Target Name>" do
    pod "Message"
end

Then, run the following command:

$ pod install

Manually

If you prefer not to use any dependency managers, you can integrate Message into your project manually.

Embedded Framework

  • Open up Terminal, cd into your top-level project directory, and run the following command "if" your project is not initialized as a git repository:

    $ git init
  • Add Message as a git submodule by running the following command:

    $ git submodule add https://github.com/incetro/Message.git
  • Open the new Message folder, and drag the Message.xcodeproj into the Project Navigator of your application's Xcode project.

    It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.

  • Select the Message.xcodeproj in the Project Navigator and verify the deployment target matches that of your application target.

  • Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar.

  • In the tab bar at the top of that window, open the "General" panel.

  • Click on the + button under the "Embedded Binaries" section.

  • You will see two different Message.xcodeproj folders each with two different versions of the Message.framework nested inside a Products folder.

    It does not matter which Products folder you choose from, but it does matter whether you choose the top or bottom Message.framework.

  • Select the top Message.framework for iOS.

  • And that's it!

    The Message.framework is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.

Author

incetro, [email protected]

License

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