ObjectiveThe main objective of this post is to implement Toast Message using Swift programming language in iOS and OSX projects.
This tutorial illustrates to How to implement a toast message in iOS using swift with very simple interface. Swift is a new programming language for iOS and OSX project if you don’t have any information related to swift programming language then please first refer our previous blog about overview of Swift Application Development.
Follow the below mentioned steps to implement toast message using Swift programming language in iOS:
Step 1 Download JLToast & Add in Project
First download the attached sample code, then from that code copy JLToast folder and put this folder in your project and then drag and drop it in your xcode project.
Step 2 JLToast Methods
Now to display toast message; call below mentioned method. You can specify the delay to display and can specify the duration of toast message as shown in below example.
JLToast.makeText("Simple Toast Message").show()
JLToast.makeText("Toast Message With Specified Duration.", duration: 3).show()
JLToast.makeText("Toast Message With Specified Duration And Delay.", delay: 1, duration: 5) ).show()
You can also set the value of duration and delay using the variable from JLToastDelay structure.
JLToast.makeText("Toast Message With Specified Duration And Delay.", delay: JLToastDelay.ShortDelay, duration: JLToastDelay.LongDelay) ).show()
Find the sample program mentioned in step1 in below link.
You will get final Output:
I hope you found this blog helpful while Implementing Toast Message in iOS using Swift. Let me know if you have any questions or concerns regarding iOS, please put a comment here and we will get back to you ASAP.
Got an Idea of iPhone App Development? What are you still waiting for? Contact us now and see the Idea live soon. Our company has been named as one of the best iPhone App Development Company in India.
Being an iOS developer with experience of 3 years feels pretty awesome because much more than just playing around with code, software developers are the brains behind the design, installation, testing and maintenance of software systems.