TSMessages




Introduction

Welcome to the documentation for TSMessages!

TSMessages is a versatile library that allows you to easily display beautiful and customizable messages within your iOS applications. With TSMessages, you can efficiently inform and interact with your users by presenting messages in various styles and with various animations.

Features

  • Displaying different types of messages (success, error, warning, etc.)
  • Customizable message appearance with various styles and animations
  • Support for showing temporary and sticky messages
  • Allowing users to dismiss messages manually or automatically
  • Integration with navigation controllers and tab bar controllers
  • Localization support for multiple languages
  • Easy-to-use interface for displaying messages

Requirements

  • iOS 9.0+
  • Xcode 10.0+
  • Swift 4.2+

Installation

To integrate TSMessages into your project using CocoaPods, simply add the following line to your Podfile:

pod 'TSMessages'

Then, run the command pod install to install the latest version.

Usage

Setting up the Message View Controller

Before displaying any messages, you need to set up the message view controller that will handle the messages. Typically, you would do this in your AppDelegate’s didFinishLaunchingWithOptions method. Here is an example:

import TSMessages

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    TSMessage.setDefaultViewController(yourRootViewController)
    return true
}

Replace yourRootViewController with the appropriate instance of your root view controller.

Displaying Simple Messages

To display a simple message, use the following code:

TSMessage.showNotification(in: yourViewController,
                           title: "Hello!",
                           subtitle: "Welcome to TSMessages!",
                           image: UIImage(named: "icon"),
                           type: .success,
                           duration: 3.0)

You can customize the message type, duration, and other parameters to suit your needs.

Other usages



Localization

TSMessages supports localization for multiple languages. To use a specific localization, make sure to add a localized version of the strings used in the messages. You can find the Localizable.strings file in the TSMessages.bundle included with the library.

License

TSMessages is available under the MIT license. See the LICENSE file for more information.