Latest 0.3.0
Homepage https://github.com/HamzaGhazouani/HGPlaceholders
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
[Language]()
[Supports]()
Platform

Twitter: @GhazouaniHamza
codebeat badge
Documentation
Readme Score

Example

HGPlaceholders HGPlaceholders

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

Requirements

  • iOS 8.0+
  • Xcode 9.2

You also may like

  • HGCircularSlider – A custom reusable circular slider control for iOS application.

Installation

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

pod 'HGPlaceholders'

HGPlaceholders is also available through Carthage. To install
it, simply add the following line to your Cartfile:

github "HamzaGhazouani/HGPlaceholders"

Usage

  1. Inherit your UITableView class from TableView Or inherit UICollectionView from CollectionView
  2. Call the placeholder to show
  • tableView.showLoadingPlaceholder() or collectionView.showLoadingPlaceholder()
  • tableView.showNoResultsPlaceholder() or collectionView.showNoResultsPlaceholder()
  • tableView.showErrorPlaceholder() or collectionView.showErrorPlaceholder()
  • tableView.showNoConnectionPlaceholder() or collectionView.showNoConnectionPlaceholder()

Customization

If you want to change only images, just set them in your asset with this names (the framework check firstly in the main bundle):

  • loading : "hg_default-loading"
  • no_connection : "hg_default-no_connection"
  • no_results : "hg_default-no_results"
  • error : "hg_default-error"

The framework contains different defaults placeholders:

  • Basic :

tableView.placeholdersProvider = .basic or collectionView.placeholdersProvider = .basic

  • Default :

tableView.placeholdersProvider = .default or collectionView.placeholdersProvider = .default

  • Default2 :

tableView.placeholdersProvider = .default2 or collectionView.placeholdersProvider = .default2

  • Hallowen :

tableView.placeholdersProvider = .halloween or collectionView.placeholdersProvider = .halloween // for fun :)`

If you want to change the default palceholders for all table views in your project:

class ProjectNameTableView: TableView {

    override func customSetup() {
        placeholdersProvider = .basic
    }
}
class ProjectNameCollectionView: CollectionView {

    override func customSetup() {
        placeholdersProvider = .basic
    }
}

You can also add new placeholders fully customizable, you should keep in mind that the view will take table view frame, and placeholder can have only one action, please check the example project

Documentation

Full documentation is available on CocoaDocs.
You can also install documentation locally using jazzy.

Author

Hamza Ghazouani, [email protected]

License

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

Latest podspec

{
    "name": "HGPlaceholders",
    "version": "0.3.0",
    "summary": "Nice library to show placeholders and Empty States for any UITableView/UICollectionView in your project",
    "description": "A powerful framework allows you to show easily different placeholders (no resulats, loading, error occured, ...) and to create Empty States in your table view / collection view, fully customisable",
    "homepage": "https://github.com/HamzaGhazouani/HGPlaceholders",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "HamzaGhazouani": "[email protected]"
    },
    "source": {
        "git": "https://github.com/HamzaGhazouani/HGPlaceholders.git",
        "tag": "0.3.0"
    },
    "social_media_url": "https://twitter.com/GhazouaniHamza",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "HGPlaceholders/Classes/**/*",
    "resources": "HGPlaceholders/Assets/*.*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This