Convert Figma logo to code with AI

hyperoslo logoWhisper

:mega: Whisper is a component that will make the task of display messages and in-app notifications simple. It has three different views inside

3,757
366
3,757
3

Top Related Projects

💌 Easy to use and customizable messages/notifications for iOS à la Tweetbot

A drop-in replacement for UILabel that supports attributes, data detectors, links, and more

ProgressHUD is a lightweight and easy-to-use HUD for iOS. Over 5000+ animations. ‼️

The easiest way to display highly customizable in app notification banners in iOS

A very flexible message bar for UIKit and SwiftUI.

4,165

A modern iOS toast view that can fit your notification needs

Quick Overview

Whisper is a lightweight Swift library for displaying notifications and messages in iOS applications. It provides a simple and customizable way to show short-lived messages at the top of the screen, making it easy to inform users about various events or actions within the app.

Pros

  • Easy to integrate and use with a clean, simple API
  • Highly customizable appearance and behavior
  • Supports both Swift and Objective-C
  • Lightweight and has minimal impact on app performance

Cons

  • Limited to top-of-screen notifications only
  • May not be suitable for complex notification requirements
  • Lacks advanced features like user interaction or action buttons
  • Not actively maintained (last update was in 2019)

Code Examples

  1. Showing a simple message:
Whisper.show(whisper: Message(title: "Welcome to the app!"), to: navigationController)
  1. Displaying a message with a custom duration:
let message = Message(title: "Task completed", duration: 3.0)
Whisper.show(whisper: message, to: navigationController)
  1. Creating a more customized message:
let message = Message(title: "Error", subtitle: "Please try again later", backgroundColor: .red)
Whisper.show(whisper: message, to: navigationController)

Getting Started

  1. Install Whisper using CocoaPods by adding the following to your Podfile:
pod 'Whisper'
  1. Import Whisper in your Swift file:
import Whisper
  1. Show a message in your view controller:
let message = Message(title: "Hello, Whisper!")
Whisper.show(whisper: message, to: navigationController)

Competitor Comparisons

💌 Easy to use and customizable messages/notifications for iOS à la Tweetbot

Pros of TSMessages

  • More customization options for message appearance and behavior
  • Supports queuing multiple messages
  • Includes built-in animations for message display and dismissal

Cons of TSMessages

  • Less actively maintained (last update in 2017)
  • More complex setup and configuration required
  • Larger codebase, potentially impacting app size

Code Comparison

TSMessages:

TSMessage.showNotification(
    withTitle: "Title",
    subtitle: "Subtitle",
    type: .success
)

Whisper:

Whisper.show(
    whisper: Whisper(title: "Title"),
    to: navigationController,
    action: .show
)

Key Differences

  • TSMessages offers more customization but requires more setup
  • Whisper has a simpler API and is more lightweight
  • TSMessages supports message queuing, while Whisper focuses on single message display
  • Whisper is more actively maintained and updated for newer iOS versions

Use Cases

  • TSMessages: Apps requiring complex notification systems with varied styles and behaviors
  • Whisper: Projects needing a simple, lightweight notification solution with minimal setup

Both libraries provide in-app notification functionality, but they cater to different complexity levels and customization needs. Choose based on your project requirements and desired level of control over the notification system.

A drop-in replacement for UILabel that supports attributes, data detectors, links, and more

Pros of TTTAttributedLabel

  • More comprehensive text styling options, including custom link attributes and data detectors
  • Better support for accessibility features and VoiceOver
  • Longer development history and larger community, potentially leading to more stability

Cons of TTTAttributedLabel

  • Limited to label functionality, while Whisper offers a broader range of notification types
  • Less modern UI design compared to Whisper's sleek appearance
  • Requires more setup and configuration for basic use cases

Code Comparison

TTTAttributedLabel:

let label = TTTAttributedLabel(frame: CGRect(x: 20, y: 20, width: 280, height: 60))
label.text = "Hello, World!"
label.textColor = .black
label.font = UIFont.systemFont(ofSize: 16)
self.view.addSubview(label)

Whisper:

let message = Message(title: "Hello, World!", textColor: .black)
Whisper.show(whisper: message, to: navigationController, action: .show)

TTTAttributedLabel is more focused on rich text labels with extensive customization options, while Whisper provides a simpler API for displaying various types of notifications and messages within an app. The choice between the two depends on the specific requirements of your project.

ProgressHUD is a lightweight and easy-to-use HUD for iOS. Over 5000+ animations. ‼️

Pros of ProgressHUD

  • More customizable appearance options, including custom icons and animations
  • Supports both Swift and Objective-C
  • Includes additional features like progress bars and text input

Cons of ProgressHUD

  • Less focus on minimalism and simplicity compared to Whisper
  • May require more setup and configuration for basic use cases
  • Potentially higher learning curve for newcomers

Code Comparison

ProgressHUD:

ProgressHUD.show("Loading...")
ProgressHUD.showSuccess("Completed!")
ProgressHUD.showError("Error occurred")

Whisper:

Whisper.show(whisper: Whisper(message: "Loading..."))
Whisper.show(whisper: Whisper(message: "Completed!", style: .success))
Whisper.show(whisper: Whisper(message: "Error occurred", style: .error))

Both libraries offer simple ways to display messages, but ProgressHUD provides more built-in styles and options out of the box. Whisper focuses on a cleaner, more minimalistic approach, which may be preferable for projects prioritizing simplicity. ProgressHUD's additional features like progress bars and text input make it more versatile for complex use cases, while Whisper excels in providing quick, unobtrusive notifications with less configuration required.

The easiest way to display highly customizable in app notification banners in iOS

Pros of NotificationBanner

  • More customizable appearance options, including custom views and styles
  • Supports queuing multiple banners
  • Includes built-in haptic feedback

Cons of NotificationBanner

  • Larger codebase and potentially more complex to implement
  • May have a steeper learning curve for basic usage

Code Comparison

NotificationBanner:

let banner = NotificationBanner(title: "Hello", subtitle: "This is a banner", style: .success)
banner.show()

Whisper:

Whisper.show(whisper: Whisper(title: "Hello", message: "This is a whisper"))

Key Differences

NotificationBanner offers more advanced features and customization options, making it suitable for complex notification requirements. Whisper, on the other hand, provides a simpler API and is easier to implement for basic notification needs.

NotificationBanner supports iOS 10.0 and above, while Whisper supports iOS 9.0 and above. This may be a consideration depending on your target audience and device compatibility requirements.

Both libraries are actively maintained, but NotificationBanner has seen more recent updates and has a larger community of contributors.

A very flexible message bar for UIKit and SwiftUI.

Pros of SwiftMessages

  • More customizable with a wide range of pre-built styles and layouts
  • Supports interactive elements like buttons within messages
  • Offers advanced queueing and presentation options

Cons of SwiftMessages

  • Slightly more complex API, which may require more setup time
  • Larger codebase and potentially higher memory footprint
  • May be overkill for simple notification needs

Code Comparison

SwiftMessages:

let view = MessageView.viewFromNib(layout: .cardView)
view.configureTheme(.warning)
view.configureContent(title: "Warning", body: "Consider yourself warned.")
SwiftMessages.show(view: view)

Whisper:

Whisper.show(whisper: Message(title: "Warning", textColor: .white, backgroundColor: .yellow, images: nil))

Key Differences

  • SwiftMessages offers more built-in layouts and themes
  • Whisper has a simpler API for basic notifications
  • SwiftMessages supports interactive elements, while Whisper focuses on non-interactive messages
  • SwiftMessages provides more control over message presentation and dismissal

Both libraries are suitable for displaying in-app notifications, but SwiftMessages is more feature-rich and customizable, while Whisper is simpler and more lightweight. Choose based on your project's complexity and requirements.

4,165

A modern iOS toast view that can fit your notification needs

Pros of CRToast

  • More customizable appearance options, including custom views and animations
  • Supports interactive notifications with buttons and callbacks
  • Better suited for complex notification layouts and interactions

Cons of CRToast

  • Steeper learning curve due to more configuration options
  • Less lightweight and potentially more resource-intensive
  • Not as actively maintained (last update was several years ago)

Code Comparison

CRToast:

CRToastManager.showNotification(options: [
    CRToastTitleTextKey: "Hello World!",
    CRToastTextKey: "This is a custom notification",
    CRToastBackgroundColorKey: UIColor.blue,
    CRToastAnimationInTypeKey: CRToastAnimationType.gravity.rawValue
], completionBlock: {})

Whisper:

Whisper.show(whisper: Message(title: "Hello World!", subtitle: "This is a custom notification"), to: navigationController, action: .show)

Summary

CRToast offers more customization and interactivity options, making it suitable for complex notification requirements. However, it has a steeper learning curve and is less actively maintained. Whisper, on the other hand, provides a simpler API and is more lightweight, making it easier to implement basic notifications quickly. The choice between the two depends on the specific needs of your project and the level of customization required.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Whisper

CircleCI License Platform

Description :leaves:

Break the silence of your UI, whispering, shouting or whistling at it. Whisper is a component that will make the task of displaying messages and in-app notifications simple. It has three different views inside.

Whispers

Whisper

Display a short message at the bottom of the navigation bar—this can be anything, from a "Great Job!" to an error message. It can have images or even a loader.

Shouts

In-App

Let users know that something happened inside the app with this beautiful customizable in-app notification.

Whistles

Whistle

This is the smallest of all, a beautiful discretion in your UI.

Bonus

All sounds are fully customizable, as are colors and fonts.

Shouts have an optional action that will be called if the user taps on it, and you'll even get a message when the Shout is gone. Finally, if you want to set how long the Shout should be displayed, you have a duration property.

In Whisper, there is no need to think about scroll view insets anymore—this will be handled automatically. As an added bonus, when transitioning from one view controller to another, the next controller's offset will be adjusted as you'd expect. It just works!

Usage

The usage of the component is so simple, you just create a message in the case of Whisper, an announcement in the case of a Shout, or a Murmur in the case of a Whistle. Because there may be a conflict with show from UIViewController, you need to explicitly use the Whisper namespace to call show.

For a Whisper:
let message = Message(title: "Enter your message here.", backgroundColor: .red)

// Show and hide a message after delay
Whisper.show(whisper: message, to: navigationController, action: .show)

// Present a permanent message
Whisper.show(whisper: message, to: navigationController, action: .present)

// Hide a message
Whisper.hide(whisperFrom: navigationController)
For a Shout:
let announcement = Announcement(title: "Your title", subtitle: "Your subtitle", image: UIImage(named: "avatar"))
Whisper.show(shout: announcement, to: navigationController, completion: {
  print("The shout was silent.")
})
For a Whistle:
let murmur = Murmur(title: "This is a small whistle...")

// Show and hide a message after delay
Whisper.show(whistle: murmur, action: .show(0.5))

// Present a permanent status bar message
Whisper.show(whistle: murmur, action: .present)

// Hide a message
Whisper.hide(whistleAfter: 3)

If you want to use Whisper with Objective-C, you can find information about it here.

Installation

Whisper is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Whisper'

Whisper is also available through Carthage. To install just write into your Cartfile:

github "hyperoslo/Whisper"

Roadmap

In the future the idea is to keep improving and add some features:

  • Improve the offset detection and animation.
  • Add more UI related components into Whisper.
  • More customization points and more sizes for each whisper.
  • Custom actions inside Whispers and Shouts.
  • We are open to new and awesome ideas, contribute if you like! :)

Author

Hyper made this with ❤️

Contribute

We would love for you to contribute to Whisper, check the CONTRIBUTING file for more info.

License

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