StatusProvider
  • August 8, 2023

Protocol to handle initial Loadings, Empty Views and Error Handling in a ViewController & views

CocoaPods Podfile


pod ‘StatusProvider’

Functions


  • Loading
  • EmptyView
  • Error Handling

How to use?


class ErrorViewController: UIViewController, StatusController {

override func viewDidLoad() {
super.viewDidLoad()

title = “Error”

let status = Status(title: “Error”, description: “Oh… fu**”, actionTitle: “Retry šŸš€”) {

}
show(status: status)
}
}

class ActivityViewController: UIViewController, StatusController {

override func viewDidLoad() {
super.viewDidLoad()

title = “Loading”

let status = Status(isLoading: true, description: “LƤdt…”)

show(status: status)
}
}

class EmptyViewController: UIViewController, StatusController {

override func viewDidLoad() {
super.viewDidLoad()

title = “Empty”

let status = Status(title: “no Data”, description: “No data available.šŸ’£”, actionTitle: “Create ā­ļø”, image: UIImage(named: “placeholder_instagram”)) {
self.hideStatus()
}

show(status: status)
}
}

GitHub


View Github

#empty #loading #protocol #viewcontroller
YOU MIGHT ALSO LIKE...
SwiftSpeech

Recognize your user's voice elegantly without having to figure out authorization and audio engines. SwiftSpeech Examples Features Installation Getting Started ...

SwiftUIValueSlider

Example To run the example project, clone the repo, and runĀ pod installĀ from the Example directory first. Requirements iOS 14.0 Installation ...

Sliders

SlidersĀ is a compilation of all my stylable drag based SwiftUI components. It provides a variety of unique controls as well ...

SlidingRuler

SlidingRulerĀ is a Swift package containing a SwiftUI control that acts like an linear infinite slider or a finite, more precise ...

Skeletonui

SkeletonUI aims to bring an elegant, declarative syntax to skeleton loading animations. Get rid of loading screens or spinners and ...