Hello everyone!

Today I’m going to show you how you can easily create toast in iOS. To achieve this task I’m going to use Charles Scalesse’s Toast API.

First of all download the file from the above link, then add UIView+Toast.h and UIView+Toast.m to your project along with the QuartzCore framework.

As soon as you’ll try adding UIView+Toast.h and UIView+Toast.m to your project a prompt will appear asking to add a bridging-header. Press “YES”. A file ending with  -Bridging-Header.h will be available in your project explorer. Open it and write #import “UIView+Toast.h”.

Now lets say you have a button on which on press you want to make a toast for that purpose write the following code in your ViewController.swift or what ever your class name is.

[code language=”css”] @IBAction func simpleToast(sender: AnyObject) {
self.view.makeToast(“I Love Swift”);


You’re gonna get a result similar to this:

If you want a toast to appear in the center and with a title.

[code language=”css”] @IBAction func positionalToast(sender: UIButton){
self.view.makeToast(“I Love Swift”, duration: 5.0, position: CSToastPositionCenter, title: “Hello!”)


This is what you’ll see.

A toast with an image is also possible with this API.

Resulting toast.

I have made this project, to save time you can download or pull it from my Github.

If you guys have any questions, please leave a comment.



Leave a Reply

Your email address will not be published. Required fields are marked *