CosmicMind / Material

A UI/UX framework for creating beautiful applications.
http://cosmicmind.com
MIT License
11.99k stars 1.26k forks source link

Snackbar in one line? #1278

Closed kaunteya closed 5 years ago

kaunteya commented 5 years ago

Hi. Is there a way where I could show Snackbar with least efforts. Some thing like

import Material

@IBAction func buttonPressed() {
      Snackbar.show("Reminder!!")
}

After going through the sample project it seems that I will have to assign a View controller whose rootView controller is a type of SnakViewController to the window.rootViewController. Isnt there a simpler approach? Some thing similar to Toaster

daniel-jonathan commented 5 years ago

Hey @kaunteya if you want the Snackbar to be aligned and animated in the correct position, you will have to use the controller, otherwise there is no way for the math to be handled and correctly overlaid. That said, the Snackbar is decoupled so that you could manage it on your own in a more appropriate format that works for you. So short answer, the sample is the simplest approach if you don't want to handle any of the animation.