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

Last update: Jun 11, 2022

Whisper

CircleCI License Platform

Description 🍃

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.

GitHub

https://github.com/hyperoslo/Whisper
Comments
  • 1. Fix/shout

    • Rename free functions to lowercase first letter. This preserves Whisper namespace, and make ColorList, FontList, Config under namespace. 😈 THIS IS BREAKING CHANGES 👿
    • Allow Shout text to be 2 lines
    • Update layout to deal with when Shout image is nil or subtitle is empty

    simulator screen shot 13 may 2016 12 42 44 simulator screen shot 13 may 2016 13 22 42

    Reviewed by onmyway133 at 2016-05-13 10:39
  • 2. issue with swift 4 & Xcode 9

    Hi!

    Thank you for this wonderful library but I am having troubles with the migration to swift 4 from swift 3.

    I am using Xcode 9 and Whisper version 5.1.0 that comes with swift 4 support but when trying to run my project I have 16 issues regarding this library. All issues are the same_

    Argument of '#selector' refers to instance method 'orientation ... that is not exposed to Objective-C

    and

    'shared' is unavailable: Use view controller based solutions where appropriate instead

    Since I am seeing that this library is working with swift 4 what I am doing wrong?

    Thank you!

    Reviewed by josmanperez at 2017-10-25 12:04
  • 3. 'show' is getting confused with UIViewController show in swift3 branch

    The latest beta XCode is having issues with the show method. There is a show method on UIViewController that it keeps getting confused with. Not sure why it can't differentiate between the two but it can't.

    A better way of defining these methods might be the following:

    public func showAnnouncement(_ announcement: Announcement, to: UIViewController, completion: (() -> Void)? = nil)

    public func showMurmur(_ murmur: Murmur, action: WhistleAction = .show(1.5))

    public func showMessage(_ message: Message, to: UINavigationController, action: WhisperAction = .Show)

    Then you can leave the first label off when calling:

    showAnnouncement(announcementVar, to: self) showMurmur(murmurVar, .show(2.0)) showMessage(messageVar, to: self.navigationController, .Show(2.0))

    Reviewed by bedaronco at 2016-09-02 12:20
  • 4. Feature: add an activity notification, with progress bar

    Facebook uses a nice in-app banner when the user taps "Post". The user see a progress bar indicating the posting process, while at end, signalling it's done.

    Would be great if such one will be added to Whisper.

    Reviewed by oferRounds at 2016-01-16 08:22
  • 5. Problem with TableView Insets

    Hi! I have two TableViewControllers as you can see in the video I've attached here. In the 2nd one I show a permanent Whisper notification (the only thing I've changed is the WhisperView height to 38). When the user press back, on viewWillDisappear() I invoke Silent(navigationController!) and the insets for the first TableViewControllers breaks. It returns top = -38 instead of top = 0.0, as my navigationBar is opaque, not transparent. The second time I do it, as you can see in the video, the insets becomes worst, because this time it returns top = -76, so 38 x 2. And it goes on and on. I have tried to solve this but couldn't exactly found the right line to modified in the pod. Hope you can help me! Thank you very much! Pablo movie

    Reviewed by PabloLV at 2016-03-14 19:45
  • 6. Whisper effect it's superview when it's called to show in viewDidLoad or viewDidAppear

    Hello, Merry X-Mas !

    I have a problem when I try to show Whisper at the functions viewDidLoad or viewDidAppear the tableview add strange space at it's top, please take a look in to the attached photo screen shot 2015-12-25 at 12 42 48 am

    if I show Whisper by using the button it work perfect.

    You could found this bug in my demo project : https://github.com/0x686169/NiceWhisper

    Hope you fix this soon as soon.

    Thank you very much,

    Reviewed by haithngnbak at 2015-12-24 17:46
  • 7. Whistle restart application without crashing

    Hi, If I try to call a Murmur my application restart to the Initial View Controller.

    var murmur = Murmur(title: "Can you retry please?")
    Whistle(murmur) //Restart if this is not commented
    

    Same behavior with iPhone or simulator. Only tested with latest SDK iOS 9.2.0. Any idea?

    Reviewed by VivienGiraud at 2016-03-11 11:25
  • 8. Extended whisper background height to embrace the notch

    Well, I guess there's no perfect solution, but what would you think of having the whistles display all the way from the top of the screen on the iPhone X?

    design proposal

    Reviewed by gilserrap at 2017-11-06 12:48
  • 9. Support Buttons

    In the current implementation Whisper has no intention to use buttons in the whisper. Is it possible to add buttons with different callbacks to manage this?

    Reviewed by mRs- at 2016-01-18 07:15
  • 10. Whisper.show bug

    the setup is like this: when u click button A, it call Whisper.show

    If u click multiple time on that buttonA, ur screen will keep pushed up and it getting smaller

    Reviewed by cwt2829 at 2017-03-20 04:43
  • 11. 🛠 Bug: terminating application

    You create new UIWindow in WhistleFactory() on 20nd line.

    It cause the application crash on didFinishLaunchingWithOptions methods because of followings in my opinion.

    http://stackoverflow.com/a/33958144/3022613

    2016-05-11 04:32:22.166 Smart Citizen[742:145841] *** Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3512.60.7/UIApplication.m:3401
    2016-05-11 04:32:22.168 Smart Citizen[742:145841] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
    *** First throw call stack:
    (0x1834f2e38 0x182b57f80 0x1834f2d08 0x183e78124 0x1888e6ad0 0x1888e3674 0x184e937ac 0x184e93618 0x184e939c8 0x1834a9124 0x1834a8bb8 0x1834a68b8 0x1833d0d10 0x1886ab834 0x1886a5f70 0x1000ae594 0x182f6e8b8)
    libc++abi.dylib: terminating with uncaught exception of type NSException
    

    Can you provide any solution for this? Why do you need to create new UIWindow?

    BTW: Without Whisper pod everything works well, same AppDelegate.swift file.

    If you want to investigate problem I can share my project folder.

    Reviewed by muhasturk at 2016-05-11 01:44
  • 12. WhistleFactory whistleWindow not removed after display?

    Is there a reason why the whistleWindow is not removed after displaying? It's causing issues in my code whenever I call UIApplication.shared.windows.first, which returns the whistleWindow and not the expected keyWindow.

    I forked the project and made whistleWindow an optional and I set it to nil when the display has finished.

    public func hide() {
        let finalOrigin = view.frame.origin.y - titleLabelHeight - Dimensions.notchHeight
        UIView.animate(withDuration: 0.2, animations: {
          self.whistleWindow?.frame.origin.y = finalOrigin
          }, completion: { _ in
            if let window = self.previousKeyWindow {
              window.isHidden = false
              self.whistleWindow = nil // Setting this to nil... Will this cause any problems?
              self.previousKeyWindow = nil
              window.rootViewController?.setNeedsStatusBarAppearanceUpdate()
            }
        })
      }
    

    Will this solution cause any problems?

    Reviewed by JCsplash at 2021-06-09 18:46
  • 13. Murmur text is overlapped by the iOS status bar text

    Hi there,

    It's a great library. Thank you for your work.

    I am experiencing the following issue:

    When I display a Murmur the iOS status bar text is not overlapped by the Murmur text. It's kind of a merged info. I am using Xcode 12.0.1 and iPhone 8 device/simulator. Both iOS 13.7 and 14.0.1 produces the issue.

    It's happening in both Light and Dark mode. Please let me know if I am doing something wrong. Thanks!

    let murmur = Murmur(title: "Updating...", backgroundColor: .orange, titleColor: .white)
    Whisper.show(whistle: murmur, action: .present)
    

    dark

    light

    Reviewed by viktoriakrasznai at 2020-09-29 13:31
  • 14. SceneDelegate 不能出现

    swift5 iOS13之后,有SceneDelegate,导致Whisper `let murmur = Murmur(title: "This is a permanent whistle...", backgroundColor: UIColor.red, titleColor: UIColor.white)

        Whisper.show(whistle: murmur, action: .present)`
    

    失效,无法显示

    Reviewed by kou8910 at 2020-08-24 08:06
💌 Easy to use and customizable messages/notifications for iOS à la Tweetbot

Notice: TSMessages is no longer being maintained/updated. We recommend everyone migrate to RMessage. This repository will be kept as is for those who

Jun 19, 2022
Simple Swift in-app notifications
Simple Swift in-app notifications

LNRSimpleNotifications TSMessages is an amazingly powerful in-app notifications library but requires a lot of setup. LNRSimpleNotifications is a simpl

Feb 11, 2022
It is a highly configurable iOS library which allows easy styling with built in styles as well as extra header and footer views so that you can make extremely unique alerts and action sheets.
It is a highly configurable iOS library which allows easy styling with built in styles as well as extra header and footer views so that you can make extremely unique alerts and action sheets.

 CFAlertViewController CFAlertViewController is a library that helps you display and customise Alerts, Action Sheets, and Notifications on iPad and i

May 18, 2022
Highly configurable iOS Alert Views with custom content views
Highly configurable iOS Alert Views with custom content views

NYAlertViewController NYAlertViewController is a replacement for UIAlertController/UIAlertView with support for content views and UI customization. Fe

Jun 10, 2022
CoffeeToast - A swift package to easily add Toast notifications to your app

CoffeeToast A simple Swift package to add Toast Notifications to your app. Insta

Feb 3, 2022
UIPicker inside a UIAlertController
UIPicker inside a UIAlertController

DPPickerManager UIPicker inside a UIAlertController HOW TO USE : // Strings Picker let values = ["Value 1", "Value 2", "Value 3", "Value 4"] DPPickerM

May 30, 2022
SwiftOverlays is a Swift GUI library for displaying various popups and notifications
SwiftOverlays is a Swift GUI library for displaying various popups and notifications

SwiftOverlays is a Swift GUI library for displaying various popups and notifications. SwiftOverlays animated logo is kindly made by Crafted Pixels Fea

May 28, 2022
[iOS] Easy, customizable notifications displayed on top of the statusbar. With progress and activity. iPhone X ready.
[iOS] Easy, customizable notifications displayed on top of the statusbar. With progress and activity. iPhone X ready.

JDStatusBarNotification Show messages on top of the status bar. Customizable colors, font and animation. Supports progress display and can show an act

Jun 21, 2022
A Swift extension that adds toast notifications to the UIView object class.
A Swift extension that adds toast notifications to the UIView object class.

Toast-Swift Toast-Swift is a Swift extension that adds toast notifications to the UIView object class. It is intended to be simple, lightweight, and e

Jun 17, 2022
Easily create different alerts in SwiftUI

AlertWizard ????‍♂️ This package lets you easily create different alerts in SwiftUI with the call of a single function. As this is my first package th

Jun 3, 2021
BottomSheet makes it easy to take advantage of the new UISheetPresentationController in SwiftUI with a simple .bottomSheet modifier on existing views.
BottomSheet makes it easy to take advantage of the new UISheetPresentationController in SwiftUI with a simple .bottomSheet modifier on existing views.

BottomSheet makes it easy to take advantage of the new UISheetPresentationController in SwiftUI with a simple .bottomSheet modifier on existing views.

Jun 16, 2022
Bottom Sheet component is widely used in Joom application

Bottom Sheet Bottom Sheet component is widely used in Joom application Installation Swift Package Manager Swift Package Manager is a tool for managing

Jun 17, 2022
BottomSheet Component 🧪🧪🧪

BCSComponent This Source code provide a bottom sheet which allow you custom own cell,you able to show it on the bottom sheet Get started First thing f

Jun 1, 2022
The easiest way to display highly customizable in app notification banners in iOS
The easiest way to display highly customizable in app notification banners in iOS

Written in Swift 5 NotificationBanner is an extremely customizable and lightweight library that makes the task of displaying in app notification banne

Jun 20, 2022
iOS tweak to display toasts for Low Power alerts and charging

Electrode iOS tweak to display toasts for Low Power alerts and charging. Localization Want to help translate Electrode to your language? Sumbit a pull

May 8, 2022
DropView - A SwiftUI library to display Apple Pencil and Pasteboard-like alerts on iOS.
DropView - A SwiftUI library to display Apple Pencil and Pasteboard-like alerts on iOS.

DropView is a SwiftUI-based library to display alerts inspired by the Apple Pencil and pasteboard stock ones.

Jun 27, 2022
(Experimental libraries) Controls interrupt handling, such as alert views, and is compatible with UIKit and Swift UI.
(Experimental libraries) Controls interrupt handling, such as alert views, and is compatible with UIKit and Swift UI.

UIPresentCoordinator Controls interrupt handling, such as alert views, and is compatible with UIKit and Swift UI. This library manages items that are

Jan 22, 2022
Display Apple system-like self-hiding status alerts. It is well suited for notifying user without interrupting user flow in iOS-like way.
Display Apple system-like self-hiding status alerts. It is well suited for notifying user without interrupting user flow in iOS-like way.

StatusAlert is being sponsored by the following tool; please help to support us by takin a look and signing up to a free trial. Dependency managers Fe

Jun 8, 2022
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps.
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps.

SwiftEntryKit ?? Donations can be made here. Table of Contents Overview Features Example Project Example Project Installation Presets Playground Requi

Jun 18, 2022