Sheeeeeeeeet lets you create menus that can be presented as custom action sheets, context menus, alert controllers, or in any way you like.
The result can look like this or completely different:
Sheeeeeeeeet comes with many item types (standard items, buttons, titles, toggles, etc.) and can be extended with your own custom item types.
Sheeeeeeeeet's custom action sheets can be styled to look just like a UIAlertController
or completely different. You can also customize how they are presented and dismissed.
Sheeeeeeeeet supports iOS 9
and later.
Sheeeeeeeeet can be installed with the Swift Package Manager:
https://github.com/danielsaidi/Sheeeeeeeeet.git
or with CocoaPods:
pod Sheeeeeeeeet
You can also clone the repository and build the library locally.
With Sheeeeeeeeet, you start with creating a menu, like this:
let item1 = MenuItem(title: "Int", value: 1)
let item2 = MenuItem(title: "Car", value: Car())
let button = OkButton(title: "OK")
let items = [item1, item2, button]
let menu = Menu(title: "Select a type", items: items)
Sheeeeeeeeet has many built-in item types, e.g. buttons, select items, links, etc. A complete list can be found here.
You can also create your own custom item types by inheriting any of the existing ones. For instance, if you build a car rental app, you can create a car-specific item that takes a Car
model.
You can even create your own menu types by subclassing Menu
. This makes it possible to create app-specific menus that provide specific functionality, handle specific tasks, etc.
You can present menus as custom action sheets:
let sheet = menu.toActionSheet(...) { sheet, item in ... }
sheet.present(in: vc, from: view) { sheet, item in ...
print("You selected \(item.title)")
}
You can find more information in this action sheet guide.
You can add menus as iOS 13 context menus to any view you like:
menu.addAsContextMenu(to: view) { sheet, item in ...
print("You selected \(item.title)")
}
You can find more information in this context menu guide.
You can present menus as UIAlertController
s:
let delegate = menu.presentAsAlertController(in: self, from: view) { sheet, item in ...
print("You selected \(item.title)")
}
You can find more information in this alert controller guide.
This project has a demo app that demonstrates different menus and menu items, including subclassing and appearance adjustments.
To try it out, just open and run the Sheeeeeeeeet.xcodeproj
project.
You can sponsor this project on GitHub Sponsors or get in touch for paid support.
Feel free to reach out if you have questions or if you want to contribute in any way:
- E-mail: daniel.saidi@gmail.com
- Twitter: @danielsaidi
- Web site: danielsaidi.com
Sheeeeeeeeet is available under the MIT license. See the LICENSE file for more info.