PVShow-Message 1.3.0

PVShow-Message 1.3.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Jul 2020
SPMSupports SPM

Maintained by Patrik Vaberer.




PVShow Message

Font Awesome Swift

Follow me: @vaberer

I like ★. Do not forget to ★ this super convenient library.

Simple library to show custom messages with a touch event. Fully customizable via properties. If any message is currently showing and you want to show another message, it will wait until a previous message will dismiss.

Works perfectly in portrait, landscape mode and with constraints.

Requirements

  • iOS 8.0+
  • Xcode 6.3

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:

$ gem install cocoapods

To integrate PVShow Message into your Xcode project using CocoaPods, specify it in your Podfile:

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

pod 'PVShow-Message', '~> 1.3.0'

Then, run the following command:

$ pod install

Do not forget to import to your swift files where you want to use this library:

import PVShow_Message

Manually

  1. Copy PVShowMessage.swift file into your project

Usage

Show Message

    PVShowMessage.instance.showMessage(text: "All data has been updated\nYou have fresh data")

Customize your message view via these properties

        PVShowMessage.cBackgroundColor = .black
        PVShowMessage.cBorderColor = .clear
        PVShowMessage.cBorderWidth = 3
        PVShowMessage.cCornerRadius = 0
        PVShowMessage.cFont = UIFont.systemFont(ofSize: 20)
        PVShowMessage.cTextColor = .white
        PVShowMessage.cPositionFromEdge = 200
        PVShowMessage.cExtraShowTimeForMessage = 3
        PVShowMessage.cInitialPosition = .top
        PVShowMessage.cAnimationDuration = 1.5

Touch event via Delegation

You can attach any identifier to the message view and it will be returned to you via a delegate method

    PVShowMessage.instance.showMessage(text: "My Text", identifier: "identifier")

Tell a message view who is delegate in a viewWillAppear method

override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        
        PVShowMessage.instance.delegate = self
    }

Implement PVShowMessageDelegate

    func didTapToMessage(identifier: String?) {
        
        print("Tapped to a message with identifier: \(identifier)")
    }

Removing messages from a queue

All messages which are going to be shown will be removed from a queue

    PVShowMessage.instance.removeAllMessages()

Author

Patrik Vaberer, [email protected]
LinkedIn

Licence

PVShow Message is available under the MIT license. See the LICENSE file for more info.