GithubHelp home page GithubHelp logo

mdsabujmia89 / tvostoast Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sahin/tvostoast

1.0 1.0 0.0 1.71 MB

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

License: Apache License 2.0

Ruby 32.58% Swift 67.42%

tvostoast's Introduction

TVOSToast

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

tvostoast's People

Contributors

cemolcay avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.