• Stars
    star
    631
  • Rank 71,222 (Top 2 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 10 years ago
  • Updated about 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

More Repositories

1

StarryStars

StarryStars is iOS GUI library for displaying and editing ratings
Swift
174
star
2

SwiftConcurrentCollections

Swift Concurrent Collections
Swift
47
star
3

ReactNativeGoogleMaps

This is an example of google maps sdk integration for react-native project.
Objective-C
46
star
4

PPSwiftGifs

PPSwiftGifs provides a convenient way to show animated GIF images as a part of iOS GUI.
Swift
34
star
5

Gormen

This repository contains algorithms from book "Introduction to Algorithms" by Thomas H. Cormen implemented in Go programming language
Go
29
star
6

AlertyAlert

AlertyAlert is a nice and fluffy iOS alert library for all your alerty needs
Swift
21
star
7

Bogracz

Bogracz is dependency injection manager with some desirable properties like thread safety and support for type-safe arguments
Swift
7
star
8

CubicCube

CubicCube is a Swift GUI library for embedding view controllers on faces of cube (well, technically it's a parallelepiped, but we'll call it a cube)
Swift
5
star
9

CheeseEngine

Scala
4
star
10

RecommendyRecommender

RecommendyRecommender is a simple Collaborative filtering/recommender engine written in Swift
Swift
3
star
11

ConnectionAwareVC

UIViewController subclass which shows user notification if internet connection is lost
Swift
2
star
12

bicyclotron

Here be bicycles
JavaScript
1
star
13

SwiftDB

Toy Database
Swift
1
star
14

llvm-tutorial-plain-c

LLVM tutorial for Kaleidoscope rewritten in plain c
C
1
star
15

PPSmartJumpingController

This example solves common task of displaying similar items in UIScrollView feed (you can read more at homepage URL)
1
star
16

PPRatingBar

PPRatingBar adds Android rating bar functionality to iOS
Objective-C
1
star
17

Allocators

Playing with allocators
C++
1
star
18

GraphyGraph

Swift
1
star
19

Woof-engine

This is a little example, written in python for google app engine that allows users to upload photos, saves them in blobstorage and outputs them on webpage or via RESTful API in JSON format. It has nothing to do with website named Woof.cc, nothing at all
Python
1
star