Skip to content
A framework for displaying non intrusive alerts to your users of both "Toast" and "Snack Bar" type
Swift Objective-C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.swiftpm/xcode/package.xcworkspace/xcshareddata changed folder structure Jun 18, 2019
ExampleImages added images Jun 14, 2019
Rye changed folder structure Jun 18, 2019
Sources/Rye Fixed SPM linking Jul 4, 2019
.gitignore added animation configuration options for the Rye Jun 17, 2019
LICENSE Initial commit Jun 3, 2019
Package.swift Fixed SPM linking Jul 4, 2019
README.md

README.md

Rye

Carthage Compatible Plaforms GitHub license CircleCI

Intro

Rye allows you to present non intrusive alerts to your users of both "Toast" and "Snack Bar" types. You can choose to display the default Rye alert type or go fully custom and display your own UIView.

Examples

Custom Rye with Image Custom Rye with Button Default Rye

📝 Requirements

iOS 11.4 Swift 5

📦 Installation

Carthage

github "nodes-ios/Rye"

💻 Usage

import Rye

Display Default Rye

let ryeConfiguration: RyeConfiguration = [Rye.Configuration.Key.text: "Message for the user"]

let rye = RyeViewController.init(alertType: .toast,
                                viewType: .standard(configuration: ryeConfiguration),
                                at: .bottom(inset: 16),
                                timeAlive: 2)
rye.show()

Display Default Rye with Custom Configuration

let ryeConfiguration: RyeConfiguration = [
    Rye.Configuration.Key.text: "Error message for the user",
    Rye.Configuration.Key.backgroundColor: UIColor.red.withAlphaComponent(0.4),
    Rye.Configuration.Key.animationType: Rye.AnimationType.fadeInOut]
]

let rye = RyeViewController.init(alertType: .toast,
                                viewType: .standard(configuration: ryeConfiguration),
                                at: .bottom(inset: 16),
                                timeAlive: 2)
rye.show()

Display Rye with a Custom UIView

let customRyeView = RyeView()

let rye = RyeViewController.init(alertType: .toast,
                                viewType: .custom(customRyeView),
                                at: .bottom(inset: 16),
                                timeAlive: 2)
rye.show()

Alert Type

Rye allows you to define the alert type you want to display to your user. Possible alert types are:

  • snackBar which is displayed at applications UIWindow level and allows interaction with the presented UIView
  • toast which is displayed at applications alert UIWindow level and doesn't allows interaction with the presented UIView

Position

With Rye you can specify the position where the Rye view will be displayed on screen via the position parameter, which takes an associated value that allows you to specify the inset. By default Rye will calculate the safe area insets for you, so be sure to specify only the extra desired inset.

If you decide to not provide a value for this parameter, you will be in charge of dismissing the Rye when you think it is appropriate.

Time Used

When creating an instance of RyeViewController you can choose to provide a value for the timeAlive parameter during initialisation. The value provided will be the time in seconds the Rye view will be presented on screen to the user.

Possible Rye Configurations

The following keys can be used in the configuration dictionary when presenting a default type Rye:

.backgroundColor (must be a UIColor)
.textColor (must be a UIColor)
.textFont (must be a UIFont)
.text (must be a String)
.cornerRadius (must be a CGFloat)
.animationType (must be a Rye.AnimationType)
.animationDuration (must be a TimeInterval)

If configuration is set to nil, a default configuration will be used. Any options set, will override the default state.

Example Project

To learn more, please refer to the example project contained in this repository.

👥 Credits

Made with ❤️ at Nodes.

📄 License

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

You can’t perform that action at this time.