A Swift library to design custom prompts with a great scope of options to choose from.

Overview

License Pod Version Pod Platform Pod License Carthage compatible

Swift Prompts.

Installation

CocoaPods

Install with CocoaPods by adding the following to your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

use_frameworks!

pod 'Swift-Prompts', '~> 1.0.0'

Note: We follow http://semver.org for versioning the public API.

Carthage

Using Carthage:

github "GabrielAlva/Swift-Prompts"

Manually

  • Just include the three .swift files found on the Swift Prompts folder on the demo Xcode project.

Usage

Using Swift Prompts is very simple and fast.

Adopting the prompt's delegate

In your class declaration, after specifying the type of class write SwiftPromptsProtocol as shown here:

class ViewController: UIViewController,  SwiftPromptsProtocol

Now, depending on the type of prompt, you can use any of the optional delegate functions

func clickedOnTheMainButton() {}
func clickedOnTheSecondButton() {}
func promptWasDismissed() {}

Displaying a prompt

First you need to declare a var outside of a function:

var prompt = SwiftPromptsView()

Next, where you would like to trigger the prompt (e.g. in the action function of a button):

prompt = SwiftPromptsView(frame: self.view.bounds)
prompt.delegate = self

//Customization

self.view.addSubview(prompt)

Dismissing a prompt

To dismiss the prompt, you can write this line in one of the delegate functions or in a different one:

prompt.dismissPrompt()

Alternatively, the dismissal by gesture is enabled by default so you can dismiss a prompt by moving it up or down until it dims completely. Dismissal by gesture will trigger the promptWasDismissed() delegate function.

Customization

Once you have your assigned the frame and delegate, you can customize the look and feel of your prompt and its background. You can customize almost every aspect of it as shown above including the width and height. The demo app is well documented for you to use any function of the customization API. To see the full list you can navigate to the SwiftPromptsView class and look for the API pragma mark.

Example

You can find a full example on usage and customization on the Xcode project attached to this repository.

License

Source code of this project is available under the standard MIT license. Please have a look at the license file.

Comments
  • Swift 4 support.

    Swift 4 support.

    Hi .. the swift 3 support pull request isn't merged for over a year. I am willing to do swift 4 migration, but only if there is a chance it is being merged soon.

    opened by ghost 7
  • UIImageEffects issue using vImage_buffer

    UIImageEffects issue using vImage_buffer

    .../devLib/Swift-Prompts/Swift-Prompts/UIImageEffects.swift:174:31: Cannot find an initializer for type 'vImage_Buffer' that accepts an argument list of type '(data: UnsafeMutablePointer, height: Int, width: Int, rowBytes: Int)'.

    After searching about this issue, I have tried: === 1 ==== var vBuffer = vImage_Buffer( data: CGBitmapContextGetData(context), height: CGBitmapContextGetHeight(context), width: CGBitmapContextGetWidth(context), rowBytes: CGBitmapContextGetBytesPerRow(context))

    return vBuffer ==== 2====

    instead of using let for data, height, width, rowBytes, I changed to var, because vImage_Buffer is using unsafe pointer.

    But the result is the same.

    In my project, I'm using (as reference to Swift-Prompt folders) the 3 files: UIImageEffects.swift, SwiftPrompts.swift, SwiftPromptsView.swift.

    xcode 6.3 captura de tela 2015-04-20 as 00 26 29

    opened by jfoc2009 3
  • Hide the top bar completely

    Hide the top bar completely

    Thanks for the aweomse prompt for Swift.

    Just wondering is there anyway / hack to completely hide the top titlebar of the prompt??

    I tried prompt.setPromptTopBarVisibility(false) but it didn't help.

    Thanks

    question 
    opened by mayooresan 1
  • Fix broken headings in Markdown files

    Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    opened by bryant1410 0
  • Error in Carthage

    Error in Carthage

    I am receiving this error in Carthage:

    *** Skipped building Swift-Prompts due to the error: Dependency "Swift-Prompts" has no shared framework schemes

    opened by guidupas 0
  • Tag new release

    Tag new release

    Please tag the new release, so Carthage can load it without setting the branch to master, otherwise it fails, because it tries to load the tagged version 1.0

    opened by patricks 0
  • Different dialogs in one class, figure out which one was clicked in the delegate methods

    Different dialogs in one class, figure out which one was clicked in the delegate methods

    I have different dialogs in one ViewController, like you did in your demo app (SwiftPromptsVC.swift)

    Is there any way to figure out which prompt was shown? So I can do different actions in in the delegate methods?

    opened by patricks 1
  • Feature to allow inclusion of an image into the prompt dialog.

    Feature to allow inclusion of an image into the prompt dialog.

    < In response to Issue #5 >

    Hi there,

    I added the ability to add in an image to the prompt. Currently the image is just added to the top of the prompt body and the prompt text is appended below it and top-aligned (as opposed to how it used to be centre-aligned in the prompt body). I think it might be a good idea to rather centre the prompt text in the remained of the prompt body under the image, but I kind of ran out of time on this one (my 11 week old daughter was beckoning :P).

    I included 3 test images, I wasn't sure if you would want these included in the Demo project or not, but they are currently in there on the prompt demos.

    I also did some minor refactoring in the SwiftPrompts.swift file. This was just for ease of reading and a touch of reuse.

    I really like this little project, great work!

    Regards, Marc

    opened by mdstroebel 2
Owner
Gabriel Alvarado
Gabriel Alvarado
PMAlertController is a great and customizable alert that can substitute UIAlertController

PMAlertController is a small library that allows you to substitute Apple's uncustomizable UIAlertController, with a beautiful and totally customizable

Paolo Musolino 2.5k Jan 3, 2023
Custom-action-sheet- - Custom action sheet with swift

Custom-action-sheet- Usage let alertController: UIAlertControllerDimmed = UIAler

Girisankar G 0 Jan 19, 2022
FloatingActionSheetController is a cool design ActionSheetController library written in Swift2.

FloationgActionSheetController FloatingActionSheetController is a cool design ActionSheetController library written in Swift2. Overview Requirements X

Ryo Aoyama 141 Oct 30, 2022
NiceAlertView is a Swift framework that can increase time of development and show nice custom AlertsViews

NiceAlertView Nice and beautiful AlertView for your iOS project NiceAlertView is a Swift framework that can increase time of development and show nice

Daniel Beltrami 0 Nov 24, 2021
A simple custom popup dialog view for iOS written in Swift. Replaces UIAlertController alert style.

A simple custom popup dialog view for iOS written in Swift. Replaces UIAlertController alert style.

donggyu 5 Jan 26, 2022
BottomSheet makes it easy to add custom bottom sheets to your SwiftUI apps.

BottomSheet About BottomSheet BottomSheet makes it easy to add custom bottom sheets to your SwiftUI apps. The result can look like this...or completel

Daniel Saidi 174 Jan 2, 2023
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

Nealon Young 609 Nov 20, 2022
zekunyan 608 Dec 30, 2022
Custom alert View to iOS applications

A simple, easy and custom iOS UIAlertView written in Swift Malert came to facilitates custom alert views as UIAlertController. Malert allows you to pe

Vitor Mesquita 480 Oct 29, 2022
A custom-designed reimplementation of the UIActionSheet control for iOS

TOActionSheet TOActionSheet is an iOS UI control providing a modal prompt control, similar to UIActionSheet. Unlike UIActionSheet, it can be very heav

Tim Oliver 172 Nov 17, 2022
Action sheet allows including your custom views and buttons.

CustomizableActionSheet Action sheet allows including your custom views and buttons. Installation CocoaPods Edit your Podfile: pod 'CustomizableAction

Ryuta Kibe 191 Nov 26, 2021
BeautyAlert - BeautyAlert provides alerts with custom shapes, colors, buttons

BeautyAlert helps you can easily design by determining the color, shape, and sha

chacha 17 Sep 8, 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
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
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

Peter Prokop 632 Dec 22, 2022
GUI library for displaying various popups (HUD), written in pure Swift.

SwiftNotice SwiftNotice is a GUI library for displaying various popups (HUD) written in pure Swift, fits any scrollview and supports iPhone X. Feature

John Lui 838 Dec 9, 2022
DGBottomSheet - The lightest swift bottom sheet library

DGBottomSheet Requirements Installation Usage DGBottomSheet The lightest swift b

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