aschuch / StatefulViewController

Placeholder views based on content, loading, error or empty states
MIT License
2.14k stars 149 forks source link

Access NSError Object in ErrorView #7

Open mschonvogel opened 9 years ago

mschonvogel commented 9 years ago

In order to give the user a more concrete info than just "Something went wrong.", it would be straightforward to have access to the NSError object in the view.

aschuch commented 9 years ago

Hi, thanks for the suggestion.

I was thinking about a generic PlaceholderViewProtocol that every placeholder view can optionally adopt. The protocol gets called whenever the view

Optionally, the current state (including any errors) might be passed with these calls. Would that be sufficient in your case?

mschonvogel commented 9 years ago

Yes, that would be sufficient. One more thing: In some of my ViewControllers, I would like the StatefulView not to cover the whole screen. I would like to set an y-offset or a custom constraint. Is there a non-hacky way to achieve that? Thanks!

aschuch commented 9 years ago

Perfect. :+1: Not sure when I will start to tackle this issue, if you want to hack on it feel free to open a pull request any time.


Regarding your question: A quick solution would be to use a transparent view as one of your placeholder views. However, this will block the UI behind it.

Alternatively, we could look into the possibility to provide a delegate method (on the view or the controller) to return the constraints for specific views.

jyounus commented 8 years ago

Any updates on exposing the NSError object inside the error view? I would really like to give a better explanation to the user why the operation failed, instead of a generic message.