Show custom Toast using PowerplayToastKit in your iOS app

Mithilesh Parmar
Powerplay
Published in
3 min readOct 23, 2021

Giving visual feedback to the users whenever they perform a certain action is an integral part of any app. The feedback might be a success message, a warning, or an error, etc.

In this article, we will see how we can show Toast and other custom view using PowerplayToastKit as shown below

If you want to know how PowerplayToastKit is created, you can refer to
Create your own Toast library from scratch’

=

You can simply show Toast using below snippet

You can also show different type of Toast by passing type param to showToast() function like warning, success, info, error .

That’s not it. We can customise ToastView appreance using ToastThemeBuilder. This library also provide functionality to show Custom view in place of ToastView.

Customize ToastView appearance

Here’s how we can change the background color and corner-radius of Toast using ToastBuilder and ToastThemeBuilder

Now let’s see, How we can replace Toast With Custom View

1. First Let us define a custom view that needs to be shown, for this example we will be going forward with a Basic Dialog which appears at the bottom of the screen and has an Image View, Title Label, Message Label, and a primary button.

2. Show DialogView at bottom position of the window

3. Here is the final result! 🥳🥳

Other use-cases for this library can be to show:

  • New feature update dialog
  • In-App feedback dialog
  • In-App force update dialog
  • In-App rating dialog

This has been published as an open source CocoaPod Library. You can check out the GitHub repo for full source code.

Did you know 😲 You can give up to 50 Claps for an article? Click/Tap and hold the clap button for a few seconds and BAM! Try it out 😋

Thank you for reading, hope it helps ✨ Any doubts or suggestions in the comment section are most welcome.

Follow me on Linkedin | Twitter | Github

--

--