Skip to content
Sheeeeeeeeet is a Swift library for custom action sheets.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Fastlane Reenable pod push in Fastfile Mar 26, 2019
Readmes Prepare the 1.2.2 hotfix Jan 17, 2019
Resources Cave in and add a reference hint to the logo Feb 23, 2018
Sheeeeeeeeet.xcodeproj Migrate to Swift 5 Mar 26, 2019
Sheeeeeeeeet Bump to 2.0.0 Mar 26, 2019
SheeeeeeeeetExample Bump to 2.0.0 Mar 26, 2019
SheeeeeeeeetTests Bump to 2.0.0 Mar 26, 2019
.gitignore
.swift-version Update Swift version in badge Apr 15, 2019
.swiftlint.yml Solve strange dismiss glitch with a delay Oct 17, 2018
.travis.yml
Cartfile Finish readme Nov 28, 2017
Cartfile.private Add Quick and Nimble Nov 28, 2017
Cartfile.resolved
LICENSE
README.md Update Swift version in badge Apr 15, 2019
RELEASE_NOTES.md Update release notes Mar 26, 2019
Sheeeeeeeeet.podspec Bump to 2.0.0 Mar 26, 2019

README.md

Version CocoaPods Carthage Platform Swift 5.0 License Twitter: @danielsaidi

About Sheeeeeeeeet

Sheeeeeeeeet is a Swift library for creating custom action sheets. It comes with many built-in components and can be extended with your own custom components.

Sheeeeeeeeet's action sheets can be styled to look like a UIAlertController or a lot different. You can also customize how they are presented and dismissed.

Installation

CocoaPods

To install Sheeeeeeeeet with CocoaPods, add this to your Podfile:

pod 'Sheeeeeeeeet'

Carthage

To install Sheeeeeeeeet with Carthage, add this to your Cartfile:

github "danielsaidi/Sheeeeeeeeet"

Manual installation

To add Sheeeeeeeeet to your app without Carthage or CocoaPods, clone this repo and place it somewhere on disk, then add Sheeeeeeeeet.xcodeproj to the project and add Sheeeeeeeeet.framework as an embedded app binary and target dependency.

Basic example

The most basic way to create an action sheet, is to specify items and the select action, like this:

let title = ActionSheetTitle(title: "Select a value type")
let item1 = ActionSheetItem(title: "Int", value: 1)
let item2 = ActionSheetItem(title: "String", value: "Hi!")
let item3 = ActionSheetItem(title: "Car", value: Car())
let button = ActionSheetOkButton(title: "OK")
let items = [title, item1, item2, item3, button]
let sheet = ActionSheet(items: items) { sheet, item in
    if let value = item.value as? Int { print("You selected an int: \(value)") }
    if let value = item.value as? String { print("You selected a string: \(value)") }
    if let value = item.value as? Car { print("You selected a car") }
    if item.isOkButton { print("You tapped the OK button") }
}

To present the action sheet, just call any of its present functions, like this:

sheet.present(in: self, from: view, completion: ...)   // or
sheet.present(in: self, from: barButtonItem, completion: ...)

The from view is optional and is only used if the action sheet it presented in a popover.

Advanced example

You can use Sheeeeeeeeet to create really basic action sheets like the one above, as well as very competent and self-contained ones. The one above is just a start. When you have the basics under control, check out this example to see how you can take things one step further.

Item Types

Sheeeeeeeeet comes with many built-in item types, e.g. regular items, single and multi-select items, links, collection-based items, custom items, buttons, titles etc. For a complete list of item types, click here.

Appearance

Sheeeeeeeeet lets you fully customize the appearances of action sheets and their views and items. You can change fonts, colors and images as well as item heights and even more stuff. For a complete guide, click here.

Specifying items after initialization

If you require a created action sheet instance to resolve which items to present (very common when you subclass ActionSheet), just create a sheet with no items then call setup(with:) once its created.

Example App

This project contains an example app that demonstrates basic and advanced action sheet, as well as how to handle subclassing, appearances etc. Before you can run it you must install Carthage and run carthage update --platform iOS. You can then open the project and try out the different sheets and item types.

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.

You can’t perform that action at this time.