All Projects → chriszielinski → Ribbon

chriszielinski / Ribbon

Licence: mit
🎀 A simple cross-platform toolbar/custom input accessory view library for iOS & macOS.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Ribbon

Guitar
A Cross-Platform String and Regular Expression Library written in Swift.
Stars: ✭ 641 (+134.8%)
Mutual labels:  cross-platform, cocoapods, carthage
Natrium
A pre-build (Swift) script to alter your Xcode project at pre-build-time per environment, build configuration and target.
Stars: ✭ 131 (-52.01%)
Mutual labels:  ribbon, cocoapods, carthage
Randomkit
Random data generation in Swift
Stars: ✭ 1,458 (+434.07%)
Mutual labels:  cross-platform, cocoapods, carthage
Datez
📆 Breeze through Date, DateComponents, and TimeInterval with Swift!
Stars: ✭ 254 (-6.96%)
Mutual labels:  cocoapods, carthage
Harpy
Harpy checks a user's currently installed version of your iOS app against the version that is currently available in the App Store. If a new version is available, an alert can be presented to the user informing them of the newer version, and giving them the option to update the application.
Stars: ✭ 2,619 (+859.34%)
Mutual labels:  cocoapods, carthage
Wechatkit
一款快速实现微信第三方登录的框架(Swift版) SDK 1.8.5
Stars: ✭ 249 (-8.79%)
Mutual labels:  cocoapods, carthage
Localize
Localize is a framework writed in swift to localize your projects easier improves i18n, including storyboards and strings.
Stars: ✭ 253 (-7.33%)
Mutual labels:  cocoapods, carthage
Colorizeswift
Terminal string styling for Swift.
Stars: ✭ 253 (-7.33%)
Mutual labels:  cocoapods, carthage
Swiftytexttable
A lightweight library for generating text tables.
Stars: ✭ 252 (-7.69%)
Mutual labels:  cocoapods, carthage
Uxmpdfkit
An iOS PDF viewer and annotator written in Swift that can be embedded into any application.
Stars: ✭ 260 (-4.76%)
Mutual labels:  cocoapods, carthage
Tabtoolbar
A small library for creating tabbed toolbars
Stars: ✭ 129 (-52.75%)
Mutual labels:  ribbon, toolbar
Progress.swift
⌛️ Add beautiful progress bars to your loops.
Stars: ✭ 265 (-2.93%)
Mutual labels:  cocoapods, carthage
Alertift
Swifty, modern UIAlertController wrapper.
Stars: ✭ 242 (-11.36%)
Mutual labels:  cocoapods, carthage
Sensor Visualizer Kit
Visualize iOS sensors for live presentations, iOS AppStore demos, Apple Store prototypes, design reviews.
Stars: ✭ 242 (-11.36%)
Mutual labels:  cocoapods, carthage
Simplecheckbox
A simple Checkbox
Stars: ✭ 253 (-7.33%)
Mutual labels:  cocoapods, carthage
Swiftpagemenu
Customizable Page Tab Menu Controller 👍
Stars: ✭ 233 (-14.65%)
Mutual labels:  cocoapods, carthage
Swipycell
Easy to use UITableViewCell implementing swiping to trigger actions.
Stars: ✭ 230 (-15.75%)
Mutual labels:  cocoapods, carthage
Sync
JSON to Core Data and back. Swift Core Data Sync.
Stars: ✭ 2,538 (+829.67%)
Mutual labels:  cocoapods, carthage
Gifu
High-performance animated GIF support for iOS in Swift
Stars: ✭ 2,703 (+890.11%)
Mutual labels:  cocoapods, carthage
Corestore
Unleashing the real power of Core Data with the elegance and safety of Swift
Stars: ✭ 3,254 (+1091.94%)
Mutual labels:  cocoapods, carthage

Ribbon 🎀

Supported Platforms Carthage compatible Pod Version codebeat badge Swift Version GitHub license PRs Welcome

Header

A simple cross-platform toolbar/custom input accessory view library for iOS & macOS.
Written in Swift.


Looking for...

  • A type-safe, XPC-available SourceKitten (SourceKit) interface with some sugar? Check out Sylvester 😼.
  • A Floating Action Button for macOS? Check out Fab. 🛍️.
  • An Expanding Bubble Text Field for macOS? Check out BubbleTextField 💬.
  • An integrated spotlight-based onboarding and help library for macOS? Check out Enlighten 💡.

Features

🎡 Try: Includes an iOS & macOS demo.

  • Provide items either programmatically or from a JSON configuration file.
  • Dark mode.
  • + more!

iOS

macOS

  • Supports push, action, & segmented control toolbar items.
  • Provides NSMenuItems for each item.

Requirements

  • iOS 10.0+ (12.0+ for dark mode)
  • macOS 10.12+ (10.13+ for full functionality)

Installation

Ribbon is available for installation using Carthage or CocoaPods.

Carthage

github "chriszielinski/Ribbon"

CocoaPods

pod "Ribbon"

iOS 13

Building for iOS 13 requires Xcode 11 and modifying iOS13.xcconfig:

// Uncomment to build Ribbon for iOS 13.
//
// - Note: Requires Xcode 11.

SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) IOS13

Usage

There are two ways of integrating Ribbon into your project:

Configuration File

🔥 The recommended approach.

The configuration file makes for a quick & easy integration. The default configuration filename is ribbon-configuration.json and should be copied into the target's bundle resources (in the Copy Bundle Resources build phase).

The JSON below defines a single action item and toolbar configuration—which is only relevant for the macOS platform.

🧐 See: Demos/Shared/ribbon-configuration.json for a more comprehensive example.

{
    "items": [
        {
            "action": "actionItemHandler",
            "controlKind": "action",
            "identifier": "action-item-identifier",
            "imageName": "NSActionTemplate",
            "keyEquivalent": "a",
            "keyEquivalentModifier": ["command", "shift"],
            "title": "Action Item",
            "toolTip": "The action button's tool-tip.",
            "subitems": [
                {
                    "action": "firstActionSubitemHandler",
                    "identifier": "first-action-subitem",
                    "imageName": "hand.thumbsup",
                    "keyEquivalent": "1",
                    "keyEquivalentModifier": ["command"],
                    "title": "First Action Subitem",
                    "toolTip": "The first action's tool-tip."
                },
                {
                    "action": "secondActionSubitemHandler",
                    "identifier": "second-action-subitem",
                    "imageName": "hand.thumbsdown",
                    "keyEquivalent": "2",
                    "keyEquivalentModifier": ["command"],
                    "title": "Second Action Subitem",
                    "toolTip": "The second action's tool-tip."
                }
            ]
        }
    ],
    "toolbar": {
        "displayMode": "iconOnly",
        "sizeMode": "regular",
        "identifier": "toolbar-identifier",
        "defaultItems" : ["NSToolbarFlexibleSpaceItem", "action-item-identifier"]
    }
}

Integration into your view controller is as simple as:

📌 Note: The code below is an abstraction and will not compile.

import Ribbon

class YourViewController ... {

    ...
    
    var ribbon: Ribbon!

    override func viewDidLoad() {
        ribbon = try! Ribbon.loadFromMainBundle(target: self)

        #if canImport(UIKit)
        textView.inputAccessoryView = ribbon
        #endif
    }
    
    #if canImport(AppKit)
    override func viewWillAppear() {
        view.window?.toolbar = ribbon.toolbar

        super.viewWillAppear()
    }
    #endif
    
    @objc
    func actionItemHandler() { }

    @objc
    func firstActionSubitemHandler() { }

    @objc
    func secondActionSubitemHandler() { }

}

Programmatically

📌 Note: The code below is an abstraction and will not compile.

import Ribbon

class YourViewController ... {

    ...
    
    var ribbon: Ribbon!

    override func viewDidLoad() {
        let firstActionSubitem = RibbonItem(subItemTitle: "First Action Subitem")
        firstActionSubitem.action = #selector(firstActionSubitemHandler)
        let secondActionSubitem = RibbonItem(subItemTitle: "Second Action Subitem")
        secondActionSubitem.action = #selector(secondActionSubitemHandler)

        let actionItem = RibbonItem(controlKind: .action,
                                    title: "Action Item",
                                    subitems: [firstActionSubitem, secondActionSubitem])
        actionItem.action = #selector(actionItemHandler)
        ribbon = Ribbon(items: [actionItem], target: self)

        #if canImport(UIKit)
        textView.inputAccessoryView = ribbon
        #endif
    }
    
    #if canImport(AppKit)
    override func viewWillAppear() {
        view.window?.toolbar = ribbon.toolbar

        super.viewWillAppear()
    }
    #endif
    
    @objc
    func actionItemHandler() { }

    @objc
    func firstActionSubitemHandler() { }

    @objc
    func secondActionSubitemHandler() { }

}

// ToDo:

  • [ ] Add documentation.
  • [ ] Implement UIKeyCommand.

Community

  • Found a bug? Open an issue.
  • Feature idea? Open an issue. Do it yourself & PR when done 😅 (or you can open an issue 🙄).
  • Want to contribute? Submit a pull request.

Acknowledgements

Contributors

Frameworks & Libraries

Ribbon depends on the wonderful contributions of the Swift community, namely:

License

Ribbon is available under the MIT license, see the LICENSE file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].