danielsaidi/Sheeeeeeeeet

Swift
iOS

Sheeeeeeeeet is a Swift library for creating menus, custom action sheets, context menus etc.

iosswiftactionsheetcocoapodscarthagecontext-menuuialertcontrollerpopoverspm
Star 增长趋势
Star
1.8k
Forks
114
周增长
+1
Issues
2
5001k1.5k
2017年11月2020年10月2023年9月2026年9月
README

Sheeeeeeeeet Logo

Version Swift 5.6 Swift UI MIT License Twitter: @danielsaidi Mastodon: @danielsaidi@mastodon.social

About Sheeeeeeeeet

Sheeeeeeeeet is a UIKit library that 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.

About this repository

Since I have personally moved over to SwiftUI, this repository is no longer under active development. I will however gladly merge any PRs that add value to it or fixes problems with new iOS versions.

Installation

Sheeeeeeeeet can be installed with the Swift Package Manager:

https://github.com/danielsaidi/Sheeeeeeeeet.git

or with CocoaPods:

pod Sheeeeeeeeet

If you prefer to not have external dependencies, you can also just copy the source code into your app.

Supported Platforms

Sheeeeeeeeet supports iOS 9 and later.

Getting Started

Creating a menu

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)

The library 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.

Presenting a menu as an action sheet

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.

Adding a menu as a context menu

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.

Presenting a menu as an alert controller

You can present menus as UIAlertControllers:

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.

Demo Application

The demo demonstrates different menus and menu items, including subclassing and appearance adjustments. To try it out, just open and run the Sheeeeeeeeet project.

Support

You can sponsor this project on GitHub Sponsors or get in touch for paid support.

Contact me

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 the LICENSE file for more info.

相关仓库
flutter/flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond

DartlibraryBSD 3-Clause "New" or "Revised" Licensemobileandroid
flutter.dev
178.9k31.1k
react/react-native

A framework for building native applications using React

C++MIT Licenseandroidapp-framework
reactnative.dev
126.5k25.2k
rustdesk/rustdesk

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

Rustcrates.ioappGNU Affero General Public License v3.0remote-controlremote-desktop
rustdesk.com
123k18.9k
justjavac/free-programming-books-zh_CN

:books: 免费的计算机编程类中文书籍,欢迎投稿

awesomeGNU General Public License v3.0pythonjavascript
weibo.com/justjavac
118.8k28.3k
Solido/awesome-flutter

An awesome list that curates the best Flutter libraries, tools, tutorials, articles and more.

Dartawesomeflutterawesome-list
61.1k6.9k
FiloSottile/mkcert

A simple zero-config tool to make locally trusted development certificates with any names you'd like.

GoGo ModulescliBSD 3-Clause "New" or "Revised" Licensehttpstls
mkcert.dev
59.6k3.1k
appwrite/appwrite

Appwrite® - complete cloud infrastructure for your web, mobile and AI apps. Including Auth, Databases, Storage, Functions, Messaging, Hosting, Realtime and more

TypeScriptnpmBSD 3-Clause "New" or "Revised" Licenseappwritedocker
appwrite.io
57.3k5.7k
google/material-design-icons

Material Design icons by Google (Material Symbols)

libraryApache License 2.0materialmaterial-design
google.github.io/material-design-icons/
53.9k9.7k
vsouza/awesome-ios

A curated list of awesome iOS ecosystem, including Objective-C and Swift Projects

SwiftawesomeMIT Licenseawesomeswift-library
awesomeios.dev
53.3k7k
ionic-team/ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.

TypeScriptnpmlibraryMIT Licenseionicmobile
ionicframework.com
52.6k13.3k
expo/expo

An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.

TypeScriptnpmlibraryMIT Licensemobileexpo
docs.expo.dev
52.1k13.9k
dkhamsing/open-source-ios-apps

:iphone: Collaborative List of Open-Source iOS Apps

awesomeCreative Commons Zero v1.0 Universaliosswift
52k6.1k