Latest0.9.4
Homepagehttps://github.com/danielsaidi/Sheeeeeeeeet
LicenseMIT
Platformsios 9.0
Authors

Sheeeeeeeeet

Open Source Love
GitHub version
Build Status

About Sheeeeeeeeet

Sheeeeeeeeet is a Swift library for creating custom action sheets. It comes with
some built-in items and can be extended with custom items that are more specific
to your app as well.

Sheeeeeeeeet

Sheeeeeeeeet can be designed to look just like normal UIKit action sheets or way
different. You can apply a global appearance to all action sheets, then override
that global style with individual styles for each action sheet.

By the end of this README.md, this project will have you saying Sheeeeeeeeet!

Installation

CocoaPods

Add this to your Podfile, run pod install then remember to use the generated
workspace afterwards:

pod 'Sheeeeeeeeet'

Carthage

Add this to your Cartfile, run carthage update then add the framework to the
app from Carthage/Build:

github "danielsaidi/Sheeeeeeeeet"

Manual

To add Sheeeeeeeeet to your app without Carthage or CocoaPods, clone this repo
and place it somewhere in your project folder. Then, add Sheeeeeeeeet.xcodeproj
to your project, select your app target and add the Sheeeeeeeeet framework as an
embedded binary under General and as a target dependency under Build Phases.

Example Application

This repository contains an example application. Open the Sheeeeeeeeet project
and run the SheeeeeeeeetExample target to try different types of action sheets.

Example Code

Below is a basic way to create an action sheets with Sheeeeeeeeet. Have a look
at the example app for more examples, e.g. multi and single select items, toggle
items, links etc.

func createStandardActionSheet() -> ActionSheet {
    let title = ActionSheetTitle(title: "Select an option")
    let item1 = ActionSheetItem(title: "Option 1", value: "1", image: image1)
    let item2 = ActionSheetItem(title: "Option 2", value: "2", image: image2)
    let button = ActionSheetOkButton(title: "OK")
    return ActionSheet(items: items) { _, item in
        guard let value = item.value as? String else { return }
        // You now have the selected value, e.g. "1". The ok button uses `true`.
    }
}

In a larger app, you’ll probably want to use your own domain model. Any model is
a valid item value, which means that you can always get the raw item value for
any tapped item in a sheet.

To present an action sheet, you just have to call the present function as such:

actionSheet.present(in: self, from: sourceView)

where sourceView will be used when the sheet is presented using a popover, e.g.
on iPads. You can customize how a sheet is presented by replacing its presenter
with another implementation.

Action Sheet Components

Sheeeeeeeeet comes with a large set of built-in components that can be used to
compose flexible action sheets. To create your own custom items, just inherit an
item class that best suits your needs.

Items

Items are used to present options. Sheeeeeeeeet comes with these built-in types:

The standard item corresponds to a default UIKit action sheet action. It has a
title and an image and serve as the base class for all other item types. It uses
.dismiss as tapBehavior, which means that it dismisses the action sheet when
it is tapped. All other items inherit this standard item type and its appearance.
They can then be individually styled.

Change the value of the tapBehavior property to change how items behave when a
user taps them. For instance, if you want single-select items to not dismiss the
sheet when they are tapped, set their tap behavor to .none.

Buttons

Buttons are used to apply or discard the effect of an action sheet. Sheeeeeeeeet
comes with these built-in types:

Buttons are automatically separated from other items when you create your action
sheet instance, and are presented in a separate list. On popovers, however, they
are added back to the end of the item list, since popovers look different.

Titles

Titles are non-interactive items. Sheeeeeeeeet comes with these built-in types:

You can add title components anywhere you want in your action sheets, although a
title probably looks best topmost.

Header Views

If you set the headerView property of an action sheet, it will be displayed as
a floating header above the action sheet. You can use any view as long as it can
be resized to fit the header view size.

Header views are completely removed in popovers, since popovers are solid bodies
with no transparent background.

Appearance

Sheeeeeeeeet can be globally styled by using the ActionSheetAppearance.standard
instance. All action sheets copies this instance when they are created. They can
then be individually styled without affecting the global style.

Have a look at the demo application to see how global and individual styling can
be setup. It’s really easy.

Contact me

I hope you like this library. Feel free to reach out if you have questions or if
you want to contribute in any way:

License

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

Latest podspec

{
    "name": "Sheeeeeeeeet",
    "version": "0.9.4",
    "summary": "Sheeeeeeeeet is a Swift library for custom iOS action sheets.",
    "description": "Sheeeeeeeeet is a Swift library for adding custom action sheets to your iOS apps.nIt comes with many built-in item action sheet item types, and can be extended byncustom types are more specific to your app or domain.",
    "homepage": "https://github.com/danielsaidi/Sheeeeeeeeet",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Daniel Saidi": "[email protected]"
    },
    "source": {
        "git": "https://github.com/danielsaidi/Sheeeeeeeeet.git",
        "tag": "0.9.4"
    },
    "social_media_url": "https://twitter.com/danielsaidi",
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "Sheeeeeeeeet/**/*.swift",
    "resources": "Sheeeeeeeeet/**/*.xib"
}

Pin It on Pinterest

Share This