Latest 0.9
Homepage https://github.com/svtek/TVOSToast
License MIT
Platforms tvos 9.0, requires ARC
Dependencies ManualLayout
Authors

TVOSToast codebeat

Toast component for tvOS with built-in siri remote hint support!

It looks like this:

alt tag

Installation

CocoaPods

pod 'TVOSToast'

Usage

Create a TVOSToastStyle and assign it your TVOSToast instance’s style property.
If you do not style, it will shows up with default style.
Since TVOSToastStyle is a struct and all of properties are optional, you can set style’s specific properties that fits your needs.

Highlights of style are presentation position (top left, bottom right etc), show duration, text style and appearance properties

For toast content you have several options:

  • text: String?
  • attributedText: NSAttributedString?
  • hintText: TVOSToastHintText?
  • customContent: UIView?

Setting up one of these are enough for your toast !

    let toast = TVOSToast(frame: CGRect(x: 0, y: 0, width: 800, height: 140))
    toast.style.position = TVOSToastPosition.TopRight(insets: 20)
    toast.text = "This is regular text"
    presentToast(toast)

TVOSToastRemoteHintText

This is the one of main reasons why we created this component: toasting quick tips of how to use siri remote of apple tv in the app.

Resources include all of siri remote button png files with black or white option.

This is how to show a TVOSToast with hint text:

    let toast = TVOSToast(frame: CGRect(x: 0, y: 0, width: 800, height: 140))
    toast.style.position = TVOSToastPosition.Bottom(insets: 20)
    toast.hintText = TVOSToastHintText(elements: "Press the ", TVOSToastRemoteButtonType.MenuWhite, " button to exit app")
    presentToast(toast)

TVOSToastPosition

This is the enum of toast position.
insets: CGFloat property sets an inset from presenting view’s edge

public enum TVOSToastPosition {
  case Top(insets: CGFloat)
  case TopLeft(insets: CGFloat)
  case TopRight(insets: CGFloat)
  case Bottom(insets: CGFloat)
  case BottomLeft(insets: CGFloat)
  case BottomRight(insets: CGFloat)
}

Toast

You can directly call TVOSToasts presentOnView: function to toast in a view or call presentToast: function of UIViewController which is an extension to present toast in view controller’s view.

Authors

Other tvOS projects

Latest podspec

{
    "name": "TVOSToast",
    "version": "0.9",
    "summary": "Toast component for tvOS with built-in siri remote hint support",
    "description": "Toast component for tvOS with built-in siri remote hint support.",
    "homepage": "https://github.com/svtek/TVOSToast",
    "license": "MIT",
    "authors": {
        "cemolcay": "[email protected]"
    },
    "platforms": {
        "tvos": "9.0"
    },
    "source": {
        "git": "https://github.com/svtek/TVOSToast.git",
        "tag": "0.9"
    },
    "resources": "TVOSToast/Resources/*.png",
    "source_files": [
        "TVOSToast/TVOSToast.swift",
        "TVOSToast/Resources/*.png"
    ],
    "requires_arc": true,
    "dependencies": {
        "ManualLayout": []
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This