GithubHelp home page GithubHelp logo

tvostoast's Introduction

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

tvostoast's People

Contributors

cemolcay avatar rsmoz avatar ehlersd avatar korzonek avatar koogle avatar

Stargazers

 avatar Guangming Li  avatar  avatar  avatar Ved Nig avatar Kyle Howells avatar Oops avatar Kate Krasnova avatar ultraview avatar Shashi Kumar Nagulakonda avatar 侠客老王 avatar Halil Özel avatar  avatar slientcloud avatar Jason Pepas (FloSports.tv) avatar  avatar Warif Akhand Rishi avatar Rushton Pippin avatar  avatar X.app (Developer) avatar Nick Krzemienski avatar Manikkumar avatar  avatar Hery avatar  avatar Altay avatar Nilesh  avatar Christian Vinterly avatar Weiran Zhang avatar Yee Yong avatar Vladyslav Semenchenko avatar Kevin Hirsch avatar bsorrentino avatar 杜蒙 avatar Steve Kim avatar Derick Warshaw avatar Tim Kersey avatar Shawn Wang avatar Skyfire avatar Anggra avatar 김현준 avatar Bilal Arslan avatar Matheus Albuquerque avatar Karthikeya Udupa avatar Yuji Hato avatar Nathan Blacker avatar Felix  avatar Surya Ilangovan avatar  avatar Marc Fiedler avatar  avatar  avatar Chuck Wang avatar  avatar Henry S avatar Nhàn Thuận avatar  avatar MohsinAli avatar woshizilong avatar Roman Tkachev avatar  avatar  avatar  avatar  avatar  avatar luohaoyuan avatar  avatar John Gracey avatar  avatar  avatar  avatar  avatar Johann Kerr avatar  avatar  avatar  avatar  avatar Sushil Shrestha avatar  avatar Gabriel avatar dip mondal avatar  avatar  avatar  avatar Cagdas Altinkaya avatar Kayla Harris avatar  avatar Saney Bin Faruk avatar Mathew avatar  avatar Sujon Mahmud avatar mondal45 avatar Sounchoy Haque avatar Jonas Smith avatar moooaaz avatar Bipanannda Dey avatar  avatar  avatar  avatar  avatar

Watchers

bsorrentino avatar mayulu avatar James Cloos avatar MohsinAli avatar  avatar Sahin Boydas avatar Carabineiro avatar Roman Tkachev avatar Dilek Dündaralp avatar Ibrahim Hawlader avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar Md shafiul alom avatar  avatar  avatar  avatar

tvostoast's Issues

Warning 'no rule to process file...'

Warning: no rule to process file '.../tvosToastMenuBlack.png' of type image.png for architecture x86_64
Warning: no rule to process file '.../tvosToastMenuWhite.png' of type image.png for architecture x86_64
Warning: no rule to process file '.../tvosToastPlayPauseBlack.png' of type image.png for architecture x86_64
Warning: no rule to process file '.../tvosToastPlayPauseWhite.png' of type image.png for architecture x86_64
Warning: no rule to process file '.../tvosToastScreenBlack.png' of type image.png for architecture x86_64
Warning: no rule to process file '.../tvosToastScreenWhite.png' of type image.png for architecture x86_64
Warning: no rule to process file '.../tvosToastSiriBlack.png' of type image.png for architecture x86_64
Warning: no rule to process file '.../tvosToastSiriWhite.png' of type image.png for architecture x86_64
Warning: no rule to process file '.../tvosToastVolumeBlack.png' of type image.png for architecture x86_64
Warning: no rule to process file '.../tvosToastVolumeWhite.png' of type image.png for architecture x86_64

Problem with constraints

I copied example code how to show toast. Toast is showed from TableViewController which is detail view controller in split view controller
Log:

Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728519e30 h=--& v=--& UIView:0x7ff728732070.midX == + 400>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728589b60 h=--& v=--& H:[UIView:0x7ff728732070(800)]>",
    "<NSLayoutConstraint:0x7ff72871e910 H:|-(10)-[UIView:0x7ff728732070](LTR)   (Names: '|':TVOSToast.TVOSToast:0x7ff728736c30 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7ff72871e910 H:|-(10)-[UIView:0x7ff728732070](LTR)   (Names: '|':TVOSToast.TVOSToast:0x7ff728736c30 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-02-24 15:07:09.036 Jenkins[18058:1717392] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728508900 h=--& v=--& UIView:0x7ff728732070.midY == + 70>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff72851ef70 h=--& v=--& V:[UIView:0x7ff728732070(140)]>",
    "<NSLayoutConstraint:0x7ff72870ab80 V:|-(10)-[UIView:0x7ff728732070]   (Names: '|':TVOSToast.TVOSToast:0x7ff728736c30 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7ff72870ab80 V:|-(10)-[UIView:0x7ff728732070]   (Names: '|':TVOSToast.TVOSToast:0x7ff728736c30 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-02-24 15:07:09.036 Jenkins[18058:1717392] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728519e30 h=--& v=--& UIView:0x7ff728732070.midX == + 400>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728589b60 h=--& v=--& H:[UIView:0x7ff728732070(800)]>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728667880 h=--& v=--& UILabel:0x7ff72872d660'Build started'.midX == + 400>",
    "<NSLayoutConstraint:0x7ff7287338e0 UIView:0x7ff728732070.right == TVOSToast.TVOSToast:0x7ff728736c30.right - 10>",
    "<NSLayoutConstraint:0x7ff728727d50 H:|-(10)-[UILabel:0x7ff72872d660'Build started'](LTR)   (Names: '|':TVOSToast.TVOSToast:0x7ff728736c30 )>",
    "<NSLayoutConstraint:0x7ff72870e2e0 UILabel:0x7ff72872d660'Build started'.right == TVOSToast.TVOSToast:0x7ff728736c30.right - 10>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7ff72870e2e0 UILabel:0x7ff72872d660'Build started'.right == TVOSToast.TVOSToast:0x7ff728736c30.right - 10>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-02-24 15:07:09.037 Jenkins[18058:1717392] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728667880 h=--& v=--& UILabel:0x7ff72872d660'Build started'.midX == + 400>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff72867d7d0 h=--& v=--& H:[UILabel:0x7ff72872d660'Build started'(800)]>",
    "<NSLayoutConstraint:0x7ff728727d50 H:|-(10)-[UILabel:0x7ff72872d660'Build started'](LTR)   (Names: '|':TVOSToast.TVOSToast:0x7ff728736c30 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7ff728727d50 H:|-(10)-[UILabel:0x7ff72872d660'Build started'](LTR)   (Names: '|':TVOSToast.TVOSToast:0x7ff728736c30 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-02-24 15:07:09.038 Jenkins[18058:1717392] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728508900 h=--& v=--& UIView:0x7ff728732070.midY == + 70>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff72851ef70 h=--& v=--& V:[UIView:0x7ff728732070(140)]>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728680a70 h=--& v=--& UILabel:0x7ff72872d660'Build started'.midY == + 70>",
    "<NSLayoutConstraint:0x7ff72871c870 UIView:0x7ff728732070.bottom == TVOSToast.TVOSToast:0x7ff728736c30.bottom - 10>",
    "<NSLayoutConstraint:0x7ff728723710 V:|-(10)-[UILabel:0x7ff72872d660'Build started']   (Names: '|':TVOSToast.TVOSToast:0x7ff728736c30 )>",
    "<NSLayoutConstraint:0x7ff728726930 UILabel:0x7ff72872d660'Build started'.bottom == TVOSToast.TVOSToast:0x7ff728736c30.bottom - 10>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7ff728726930 UILabel:0x7ff72872d660'Build started'.bottom == TVOSToast.TVOSToast:0x7ff728736c30.bottom - 10>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-02-24 15:07:09.038 Jenkins[18058:1717392] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728680a70 h=--& v=--& UILabel:0x7ff72872d660'Build started'.midY == + 70>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff7286022a0 h=--& v=--& V:[UILabel:0x7ff72872d660'Build started'(140)]>",
    "<NSLayoutConstraint:0x7ff728723710 V:|-(10)-[UILabel:0x7ff72872d660'Build started']   (Names: '|':TVOSToast.TVOSToast:0x7ff728736c30 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7ff728723710 V:|-(10)-[UILabel:0x7ff72872d660'Build started']   (Names: '|':TVOSToast.TVOSToast:0x7ff728736c30 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-02-24 15:07:09.039 Jenkins[18058:1717392] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728519e30 h=--& v=--& UIView:0x7ff728732070.midX == + 400>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728589b60 h=--& v=--& H:[UIView:0x7ff728732070(800)]>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff7285924f0 h=--& v=--& H:[TVOSToast.TVOSToast:0x7ff728736c30(800)]>",
    "<NSLayoutConstraint:0x7ff7287338e0 UIView:0x7ff728732070.right == TVOSToast.TVOSToast:0x7ff728736c30.right - 10>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7ff7287338e0 UIView:0x7ff728732070.right == TVOSToast.TVOSToast:0x7ff728736c30.right - 10>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-02-24 15:07:09.039 Jenkins[18058:1717392] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728667880 h=--& v=--& UILabel:0x7ff72872d660'Build started'.midX == + 400>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff72867d7d0 h=--& v=--& H:[UILabel:0x7ff72872d660'Build started'(800)]>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff7285924f0 h=--& v=--& H:[TVOSToast.TVOSToast:0x7ff728736c30(800)]>",
    "<NSLayoutConstraint:0x7ff72870e2e0 UILabel:0x7ff72872d660'Build started'.right == TVOSToast.TVOSToast:0x7ff728736c30.right - 10>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7ff72870e2e0 UILabel:0x7ff72872d660'Build started'.right == TVOSToast.TVOSToast:0x7ff728736c30.right - 10>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-02-24 15:07:09.039 Jenkins[18058:1717392] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728508900 h=--& v=--& UIView:0x7ff728732070.midY == + 70>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff72851ef70 h=--& v=--& V:[UIView:0x7ff728732070(140)]>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728571b20 h=--& v=--& V:[TVOSToast.TVOSToast:0x7ff728736c30(140)]>",
    "<NSLayoutConstraint:0x7ff72871c870 UIView:0x7ff728732070.bottom == TVOSToast.TVOSToast:0x7ff728736c30.bottom - 10>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7ff72871c870 UIView:0x7ff728732070.bottom == TVOSToast.TVOSToast:0x7ff728736c30.bottom - 10>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-02-24 15:07:09.040 Jenkins[18058:1717392] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728680a70 h=--& v=--& UILabel:0x7ff72872d660'Build started'.midY == + 70>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff7286022a0 h=--& v=--& V:[UILabel:0x7ff72872d660'Build started'(140)]>",
    "<NSAutoresizingMaskLayoutConstraint:0x7ff728571b20 h=--& v=--& V:[TVOSToast.TVOSToast:0x7ff728736c30(140)]>",
    "<NSLayoutConstraint:0x7ff728726930 UILabel:0x7ff72872d660'Build started'.bottom == TVOSToast.TVOSToast:0x7ff728736c30.bottom - 10>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7ff728726930 UILabel:0x7ff72872d660'Build started'.bottom == TVOSToast.TVOSToast:0x7ff728736c30.bottom - 10>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.

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.