Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
ViewStateProtocol extension
extension ViewStateProtocol where Self: UIViewController {
// State manager class to remove/add views
var stateManager: StateManager? {
return StateManager.sharedInstance
// Loading view
var loadingView: UIView? {
return LoadingView(frame: UIScreen.main.bounds)
// Error View
var errorView: UIView? {
return ErrorState(frame: UIScreen.main.bounds)
// Empty view
var emptyView: UIView? {
return EmptyStateView(frame: UIScreen.main.bounds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment