Latest 0.1.9
Homepage https://github.com/yucelokan/AlertBuilder
License MIT
Platforms ios 9.0
Authors

Swift
Swift
Swift
Platform
License

AlertView is a structure used in situations such as displaying a message to the user or offering a choice. There are already a lot of libraries for that. What I’m trying to do with this library; Allows the developer to create AlertView with View without forcing to use a specific view. This library is not an AlertView library. This library is a builder for AlertView. Create and show on the screen a view with AlertViewBuilder . That’s all. This view can be anything. (TextView, TextField, Label, Button, ImageView, TableView etc.)

Custom 1 Custom 3
1.png 4.png
Custom 3 Custom 4
6.png 7.png
Custom 1 Custom 3 Custom 3
2.png 8.png 9.png

Example

let alertViewBuilder = AlertViewBuilder() { (builder) in

    builder.addView(with: <ANY VIEW>, tag: 0, height: 50)

    builder.addView(with: AlertSubMessageView.init(messageText: "Message with image"), tag: 134, height: 40)

    builder.addButton(with: "Button 1", backgroundColor: .black, titleColor: .white, font: UIFont.systemFont(ofSize: 15), height: 40, action: {
        print("Button 1 clicked")
    })
    }.build()
let alertViewBuilder = AlertViewBuilder() { (builder) in

    let imageView = UIImageView.init(image: UIImage.init(named: "letter")?.withAlignmentRectInsets(UIEdgeInsets.init(top: -5, left: 5, bottom: -5, right: 5)))
    imageView.contentMode = .scaleAspectFit

    builder.addView(with: imageView, tag: 0, height: 50)

    builder.addView(with: AlertSubMessageView.init(messageText: "Message with image"), tag: 134, height: 40)

    builder.addButton(with: "Button 1", backgroundColor: .black, titleColor: .white, font: UIFont.systemFont(ofSize: 15), height: 40, action: {
        print("Button 1 clicked")
    })

    builder.addButton(with: "Button 2", backgroundColor: .orange, titleColor: .white, font: UIFont.systemFont(ofSize: 15), height: 40, action: {
        print("Button 2 clicked")
    })

    builder.addButton(with: "Button 3", backgroundColor: .white, titleColor: .black, font: UIFont.systemFont(ofSize: 15), height: 40, action: {
        print("Button 3 clicked")
    })

    builder.addButton(with: "Button 4", backgroundColor: .purple, titleColor: .white, font: UIFont.systemFont(ofSize: 15), height: 40, action: {
        print("Button 4 clicked")

    })
    }.build()
if let view = alertViewBuilder.getView(viewWithTag: 134) as? AlertSubMessageView{
    print(view.mLabelMessage.text ?? "")
}

Install

pod 'AlertViewBuilder' 

License

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

Latest podspec

{
    "name": "AlertViewBuilder",
    "version": "0.1.9",
    "swift_versions": "5.0",
    "summary": "This is a customizable Alert View.You can add any view in to Alert View while you are creating Alert View.",
    "description": "This is a customizable Alert View.You can add any view in to Alert View while you are creating Alert View. (Swift)",
    "homepage": "https://github.com/yucelokan/AlertBuilder",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "yucelokan": "[email protected]"
    },
    "source": {
        "git": "https://github.com/yucelokan/AlertBuilder.git",
        "tag": "0.1.9"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "Sources/**/*"
}

Pin It on Pinterest

Share This