Skip to content

View controller which supports changing of it's content with predefined views: ContentView, LoadingView, ErrorView, NoDataView

License

Notifications You must be signed in to change notification settings

iSapozhnik/LoadingViewController

Repository files navigation

LoadingViewController

Build Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

LoadingViewController is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "LoadingViewController"

UITableViewController and UICollectionViewController are not supported yet.

How to use

Subclass your controller from LoadingViewController. On the top of View of your controller put another UIView which will be content view. All your content should be on the top of Content view. Link contentView property with this newly created view.

override func viewDidLoad() {
	super.viewDidLoad()
	
	setVisibleScreen(.Loading)
	APIService.fetchSomeData({ response in
		// Update UI
		self.setVisibleScreen(.Content)
	}) 
}

TODO

  • add support of UITableViewController and UICollectionViewController
  • implement NoData view, Empty view
  • fix autolayout issues
  • add pull to refresh and load more features
  • code refactoring :)

Author

Sapozhnik Ivan, sapozhnik.ivan@gmail.com

License

LoadingViewController is available under the MIT license. See the LICENSE file for more info.

About

View controller which supports changing of it's content with predefined views: ContentView, LoadingView, ErrorView, NoDataView

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published