Latest 0.1.1
Homepage https://github.com/Prismik/ActionsDrawer
License MIT
Platforms ios 8.0
Dependencies PinLayout
Frameworks UIKit
Authors

CI Status
Version
License
Platform

What does it look like?

ActionsDrawer

How to use

// Using the hardcoded title approach

func present() {
    let drawerViewController = ActionsDrawerViewController(title: "Title provided as a string", actionGroups: [
        ActionGroup(actions: [
            Action(icon: nil, title: "Do the thing", tintColor: .blue, handler: {
                print("Did the thing")
            }),
            Action(icon: nil, title: "Do the other thing", tintColor: .blue, handler: {
                print("Did the other thing")
            })
        ]),
        ActionGroup(actions: [
            Action(icon: nil, title: "Do the dangerous thing thing", tintColor: .red, handler: {
                print("Did the dangerous thing")
            })
        ])
    ])
    self.drawerController = drawerViewController
    drawerViewController.delegate = self
    drawerViewController.transitioningDelegate = drawerViewController
    present(drawerViewController, animated: true, completion: nil)
}

// Using the protocol approach

struct Pizza {
    let radius: Int
    let toppings: [String]
}

extension Pizza: ActionableItem {
    var drawerView: UIView {
        let view = UILabel()
        view.text = "(radius) inch pizza - (toppings.count) toppings"
        view.textColor  = UIColor.orange
        view.font = UIFont.systemFont(ofSize: 14)
        view.textAlignment = .center
        return view
    }
}

// ...

func present() {
    let pizza = Pizza(radius: 12, toppings: ["Pepperonni", "Cheese"])

    let viewController = ActionsDrawerViewController(actionableItem: pizza, actionGroups: [
        ActionGroup(actions: [
            Action(icon: UIImage(named: "oven"), title: "Bake", tintColor: .blue, handler: {
                print("Baking the pizza")
            }),
            Action(icon: UIImage(named: "pizzaCar"), title: "Deliver", tintColor: .blue, handler: {
                print("Delivering the pizza")
            })
        ]),
        ActionGroup(actions: [
            Action(icon: UIImage(named: "garbage"), title: "Garbage", tintColor: .red, handler: {
                print("Pizza tastes bad. Putting in the garbage")
            })
        ])
    ])
}

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

ActionsDrawer is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'ActionsDrawer'

Author

Francis, [email protected]

License

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

Latest podspec

{
    "name": "ActionsDrawer",
    "version": "0.1.1",
    "summary": "A prettier alternative to action sheets.",
    "swift_version": "4.2",
    "description": "ActionsDrawer is built as a replacement to the standard action sheets. Action sheets provide little to no customization UI wise, while ActionsDrawer lets you display actions however you want (grouped, with images, etc.) in a scrollable area.",
    "homepage": "https://github.com/Prismik/ActionsDrawer",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Francis": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Prismik/ActionsDrawer.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "ActionsDrawer/Classes/**/*",
    "frameworks": "UIKit",
    "dependencies": {
        "PinLayout": [
            "~> 1.8"
        ]
    }
}

Pin It on Pinterest

Share This