SwiftOverlays is a Swift GUI library for displaying various popups and notifications

Overview

Imgur

SwiftOverlays is a Swift GUI library for displaying various popups and notifications.

SwiftOverlays animated logo is kindly made by Crafted Pixels

Build Status Carthage compatible

Features

SwiftOverlays provides several ways to notify user:

  • Wait overlay: a simple overlay with activity indicator

Wait

  • Wait overlay with text

WaitWithText

  • Overlay with text only
  • Overlay with image and text (can be used with PPSwiftGifs to show custom animated GIF instead of UIActivityIndicatorView)
  • All of the above with blocking any user interaction
  • Notification on top of the status bar, similar to native iOS local/push notifications

Notification

Installation

Manual

Just clone and add SwiftOverlays.swift to your project.

Carthage

  • > Cartfile
  • nano Cartfile
  • put github "peterprokop/SwiftOverlays" ~> 5.0.1 into Cartfile
  • Save it: ctrl-x, y, enter
  • Run carthage update
  • Copy SwiftOverlays.framework from Carthage/Build/iOS to your project
  • Make sure that SwiftOverlays is added in Embedded Binaries section of your target (or else you will get dyld library not loaded referenced from ... reason image not found error)
  • Add import SwiftOverlays on top of your view controller's code

Cocoapods

  • Make sure that you use latest stable Cocoapods version: pod --version
  • If not, update it: sudo gem install cocoapods
  • pod init in you project root dir
  • nano Podfile, add:
pod 'SwiftOverlays', '~> 5.0.1'
use_frameworks! 
  • Save it: ctrl-x, y, enter
  • pod update
  • Open generated .xcworkspace
  • Don't forget to import SwiftOverlays: import SwiftOverlays!

Requirements

  • iOS 10.0+
  • Xcode 10.0+
  • Swift 4.2 (if you need older swift version, see swift-3.0 and others)

Usage

If you're using CocoaPods, import the library with import SwiftOverlays

You can use UIViewController convenience methods provided by library:

// In your view controller:

// Wait overlay
self.showWaitOverlay()

// Wait overlay with text
let text = "Please wait..."
self.showWaitOverlayWithText(text)

// Overlay with text only
let text = "This is a text-only overlay...\n...spanning several lines"
self.showTextOverlay(text)

// Remove everything
self.removeAllOverlays()

// Notification on top of the status bar
UIViewController.showOnTopOfStatusBar(annoyingNotificationView!, duration: 5)

// Block user interaction
SwiftOverlays.showBlockingWaitOverlayWithText("This is blocking overlay!")

// Don't forget to unblock!
SwiftOverlays.removeAllBlockingOverlays()

Using with UITableViewController/UICollectionViewController

You can't use SwiftOverlays convenience methods directly with UITableViewController - because its view is, well, an UITableView, and overlay will be scrolled along with it.

Instead I suggest using UIViewController instead of UITableViewController and adding UITableView as a subview. (the same applies to UICollectionViewController)

If for some reason you can't use UIViewController, you can do something like:

if let superview = self.view.superview {
  SwiftOverlays.showCenteredWaitOverlayWithText(superview, text: "Please wait...")
  SwiftOverlays.removeAllOverlaysFromView(superview)
}

(but in that case overlay will be added to the superview, and you should obviously do that only if superview is available - for example in viewDidAppear method of your controller.).

Contribution

You are welcome to fork and submit pull requests

Other Projects

  • StarryStars - iOS GUI library for displaying and editing ratings.
  • AlertyAlert - AlertyAlert is a nice and fluffy iOS alert library for all your alerty needs.
Comments
  • Swift3

    Swift3

    Hey Peter, thanks for your library. Do you know how to include the swift 3 branch in carthage?

    I tried to put the following string in my cartfile: github "peterprokop/SwiftOverlays" "swift-3.0"

    But when I update I get the following error messages: SwiftOverlays/SwiftOverlays/SwiftOverlays.swift:303:27: error: value of type 'CGRect' has no member 'offsetInPlace' SwiftOverlays/SwiftOverlays.swift:310:27: error: value of type 'CGRect' has no member 'offsetInPlace' SwiftOverlays/SwiftOverlays/SwiftOverlays.swift:415:58: error: cannot call value of non-function type 'UIColor' SwiftOverlays.swift:418:70: error: cannot call value of non-function type 'UIScreen' SwiftOverlays/SwiftOverlays.swift:490:42: error: cannot call value of non-function type 'UIApplication'

    Thanks, Francois.

    opened by francoisduchemin 18
  • notification view presenting animation?

    notification view presenting animation?

    When you present a notification view, it doesn't animate in, it just appears, whereas when the notification view disappears, it moves up and fades out nicely. Can you change the library so that when the notification appears, it appears at the top of the screen and moves down (like the native notification). Effectively the reverse of the disappearing animation.

    Thanks

    opened by Reedyuk 5
  • deployment_target

    deployment_target

    Hi,

    In one of your last commit you said: "change deployment to 8.0" But on SwiftOverlays.podspec there is ios.deployment_target = '9.0'.

    It is normal ? Because I can't install with ios deployment target 8.0. Error of commit or error of podspec ?

    Thank in advance.

    opened by PierrickCoulon 4
  • Consider adding Carthage support.

    Consider adding Carthage support.

    Hi, I know SwiftOverlays ist just one file and an easy drop-in installation at that. But since you're providing a Cocoapods Podfile why not consider to also support Carthage. Carthage is really getting traction for Swift frameworks and it would be great to have SwiftOverlays on it.

    Cheers,

    opened by Shirk 3
  • add progress text update

    add progress text update

    Just simple implement the progress text update which could use with alamofire progress update block

    By invoke SwiftOverlays.updateWaitOverlayText(text:), the text in label view, which is subview of the container overlay view, will be update

    BTW, this method must be called in UI thread.

    opened by jeremy-kunzhou 3
  • Carthage, Xcode8 and Swift3 problem.

    Carthage, Xcode8 and Swift3 problem.

    Hello, when I try to use SwiftOverlays library with using Carthage, Xcode8 and Swift 3 I always get following error during building stage:

    `*** Building scheme "SwiftOverlays" in Example.xcodeproj 2016-09-21 07:58:49.468 xcodebuild[82596:470516] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/VVDocumenter-Xcode.xcplugin' not present in DVTPlugInCompatibilityUUIDs 2016-09-21 07:58:49.469 xcodebuild[82596:470516] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/UncrustifyPlugin.xcplugin' not present in DVTPlugInCompatibilityUUIDs 2016-09-21 07:58:49.470 xcodebuild[82596:470516] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs ** BUILD FAILED **

    The following build commands failed: CompileSwift normal arm64 /Users/admin/Documents/Projects/_//Network/Carthage/Checkouts/SwiftOverlays/SwiftOverlays/SwiftOverlays.swift CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (2 failures) /Users/admin/Documents/Projects/**/_/Network/Carthage/Checkouts/SwiftOverlays/SwiftOverlays/SwiftOverlays.swift:245:42: error: cannot call value of non-function type 'UIApplication' /Users/admin/Documents/Projects//**/Network/Carthage/Checkouts/SwiftOverlays/SwiftOverlays/SwiftOverlays.swift:303:27: error: value of type 'CGRect' has no member 'offsetInPlace' /Users/admin/Documents/Projects/_//Network/Carthage/Checkouts/SwiftOverlays/SwiftOverlays/SwiftOverlays.swift:310:27: error: value of type 'CGRect' has no member 'offsetInPlace' /Users/admin/Documents/Projects/**/_/Network/Carthage/Checkouts/SwiftOverlays/SwiftOverlays/SwiftOverlays.swift:415:58: error: cannot call value of non-function type 'UIColor' /Users/admin/Documents/Projects//**/Network/Carthage/Checkouts/SwiftOverlays/SwiftOverlays/SwiftOverlays.swift:418:70: error: cannot call value of non-function type 'UIScreen' /Users/admin/Documents/Projects/_//Network/Carthage/Checkouts/SwiftOverlays/SwiftOverlays/SwiftOverlays.swift:490:42: error: cannot call value of non-function type 'UIApplication' A shell task (/usr/bin/xcrun xcodebuild -project /Users/admin/Documents/Projects/**/**_/Network/Carthage/Checkouts/SwiftOverlays/Example/Example.xcodeproj -scheme SwiftOverlays -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65: 2016-09-21 07:58:49.468 xcodebuild[82596:470516] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/VVDocumenter-Xcode.xcplugin' not present in DVTPlugInCompatibilityUUIDs 2016-09-21 07:58:49.469 xcodebuild[82596:470516] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/UncrustifyPlugin.xcplugin' not present in DVTPlugInCompatibilityUUIDs 2016-09-21 07:58:49.470 xcodebuild[82596:470516] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs ** BUILD FAILED **

    The following build commands failed: CompileSwift normal arm64 /Users/admin/Documents/Projects/_/_/Carthage/Checkouts/SwiftOverlays/SwiftOverlays/SwiftOverlays.swift CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (2 failures) ` My cartfile content is

    github "peterprokop/SwiftOverlays" "swift-3.0"

    Could you please look at that?

    opened by lwalukie 2
  • showNotificationOnTopOfStatusBar show black bar when hiding

    showNotificationOnTopOfStatusBar show black bar when hiding

    When hiding showNotificationOnTopOfStatusBar it is showing a blackbar under the view, and first when the chosen view is hided it will remove the black bar?

    opened by Fredehagelund92 2
  • Annoying Notification's Animation

    Annoying Notification's Animation

    Corrects the annoying notification's animation which may leave a colored background until complete. Also avoids force unwraps

    Edit: This addresses the particular case where the notification's original height used to leave a black box behind as it animated closed.

    opened by jeystarratt 2
  • swift-3.0 branch requires a higher minimum target than 8.1

    swift-3.0 branch requires a higher minimum target than 8.1

    These are the target configurations in my Podfile: use_frameworks! platform :ios, '8.1'

    This is the line in my Podfile for SwiftOverlays: pod 'SwiftOverlays', :git => 'https://github.com/peterprokop/SwiftOverlays', :branch => 'swift-3.0'

    The Swift 2 version, which I was using until recently, worked with iOS 8.1, and this project's readme only says that it requires "iOS 7.0+ (8.0+ if you use Cocoapods)". When I run pod install, it gives the following printout: $ pod install Analyzing dependencies Pre-downloading: SwiftOverlays from https://github.com/peterprokop/SwiftOverlays, branch swift-3.0 [!] Unable to satisfy the following requirements:

    • SwiftOverlays (fromhttps://github.com/peterprokop/SwiftOverlays, branchswift-3.0)required byPodfile
    • SwiftOverlays (fromhttps://github.com/peterprokop/SwiftOverlays, branchswift-3.0)required byPodfile

    Specs satisfying the SwiftOverlays (fromhttps://github.com/peterprokop/SwiftOverlays, branchswift-3.0) dependency were found, but they required a higher minimum deployment target.

    Changing my podfile to require iOS 9.1 makes the pod install work, but my project would much rather support 8.1. Is there any fix for this? If not, the readme should probably be updated to reflect it.

    opened by kpapakipos 1
  • Button and text overlay

    Button and text overlay

    • New overlay that includes a button and a label
    • Corrections on calculations made on showGenericOverlay(), to make sure the label and the accessory view are placed right
    opened by rsaenzi 0
  • Swift 3.1 @discardableResult warning of showNotificationOnTopOfStatusBar

    Swift 3.1 @discardableResult warning of showNotificationOnTopOfStatusBar

    New Swift 3.1 is showing warning:

    SwiftOverlays.swift:93:5: @discardableResult declared on a function returning Void is unnecessary

    
        /**
            Shows notification on top of the status bar, similar to native local or remote notifications
    
            - parameter notificationView: View that will be shown as notification
            - parameter duration: Amount of time until notification disappears
            - parameter animated: Should appearing be animated
        */
        @discardableResult
        class func showNotificationOnTopOfStatusBar(_ notificationView: UIView, duration: TimeInterval, animated: Bool = true) {
            SwiftOverlays.showAnnoyingNotificationOnTopOfStatusBar(notificationView, duration: duration, animated: animated)
        }
    
    opened by fiveze 0
  • Add width constraints to avoid cropped text

    Add width constraints to avoid cropped text

    I use method SwiftOverlays.showBlockingWaitOverlayWithText("example. many words ...")

    If the string argument contains a several sentences ( > 8-10 words) the width will be more than the width of the screen (iPhone 5s for e.g.) So, we need width constraints.

    If we have universal app, the solution below is not suitable.(because we need different strings for ipad(without \n) and iphone)

    // Overlay with text only
    let text = "This is a text-only overlay...\n...spanning several lines"
    self.showTextOverlay(text)
    
    opened by Dekwin 0
  • iPhone X display

    iPhone X display

    On iPhone X, the notification view should be displayed a bit lower, otherwise it can't by fully seen. Is there anyone having the same issue, or am i missing something here ? There's no one report about this issue, which seems strange to me.

    opened by namanhams 3
  • Calling UIViewController.showOnTopOfStatusBar twice has strange effects

    Calling UIViewController.showOnTopOfStatusBar twice has strange effects

    Hi there,

    if you call UIViewController.showOnTopOfStatusBar(view, duration: 1, animated: true) and then call it again before the first notification disappeared, all further calls will show the notification twice.

    Please see the following clip to get a better understanding: ezgif com-video-to-gif

    Is there a way to remove the old notification that is still visible below the new one?

    opened by stefanengel 1
Releases(5.0.1)
Owner
Peter Prokop
There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Peter Prokop
Toasts and popups library written with SwiftUI

Popup View Toasts and popups library written with SwiftUI We are a development agency building phenomenal apps. Usage Put all your body code into a ZS

Exyte 1.9k Jan 5, 2023
💌 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

Felix Krause 4.9k Dec 31, 2022
[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

M Emrich 3.8k Dec 27, 2022
Whisper is a component that will make the task of display messages and in-app notifications simple. It has three different views inside

Description ?? Break the silence of your UI, whispering, shouting or whistling at it. Whisper is a component that will make the task of displaying mes

HyperRedink 3.7k Dec 25, 2022
A simple style messages/notifications, in Swift.

Demo Example To show notifications use the following code: self.showMessage("Something success", type: .success) To display a notice on a view: view.s

Gesen 704 Dec 17, 2022
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

Charles Scalesse 3.3k Dec 22, 2022
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

LISNR 203 Nov 20, 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

Maegan Wilson 2 Feb 3, 2022
🌊 - Jelly is a library for animated, non-interactive & interactive viewcontroller transitions and presentations with the focus on a simple and yet flexible API.

Jelly is a library for animated, non-interactive & interactive viewcontroller transitions and presentations with the focus on a simple and yet flexibl

Sebastian Boldt 2.4k Dec 25, 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.

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

Crowdfire Inc. 1.1k Dec 18, 2022
Swift library to manage in app notification in swift language, like WhatsApp, Telegram, Frind, ecc.

InAppNotify - Manage in App notifications During develop of my app Frind, I needed to manage in app notifications like whatsapp or telegram, but i did

Luca Becchetti 438 Nov 20, 2022
SwiftMessages is a very flexible view and view controller presentation library for iOS.

SwiftMessages Overview SwiftMessages is a very flexible view and view controller presentation library for iOS. Message views and view controllers can

SwiftKick Mobile 6.7k Jan 2, 2023
BPStatusBarAlert is a library that allows you to easily make text-based alert that appear on the status bar and below navigation bar.

BPStatusBarAlert BPStatusBarAlert is a library that allows you to easily make text-based alert that appear on the status bar and below navigation bar.

Ben.Park 131 Aug 12, 2022
An iOS library for SwiftUI to create draggable sheet experiences similar to iOS applications like Maps and Stocks.

An iOS library for SwiftUI to create draggable sheet experiences similar to iOS applications like Maps and Stocks.

Wouter 63 Jan 5, 2023
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.

Stefano Bertagno 46 Dec 4, 2022
A Swift library to provide a bouncy action sheet

Hokusai is a Swift library that provides a bouncy action sheet. It will give the users a fancy experience without taking pains coding the cool animati

Yuta Akizuki 430 Nov 20, 2022
A Swift library to design custom prompts with a great scope of options to choose from.

Installation CocoaPods Install with CocoaPods by adding the following to your Podfile: source 'https://github.com/CocoaPods/Specs.git' platform :ios,

Gabriel Alvarado 736 Nov 3, 2022
DGBottomSheet - The lightest swift bottom sheet library

DGBottomSheet Requirements Installation Usage DGBottomSheet The lightest swift b

donggyu 9 Aug 6, 2022
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

Daniel Huri 6.1k Jan 4, 2023