{"id":2905,"url":"https://github.com/HamzaGhazouani/HGPlaceholders","last_synced_at":"2025-08-06T16:31:45.629Z","repository":{"id":23023167,"uuid":"97959221","full_name":"HamzaGhazouani/HGPlaceholders","owner":"HamzaGhazouani","description":"Nice library to show placeholders and Empty States for any UITableView/UICollectionView in your project","archived":false,"fork":false,"pushed_at":"2022-01-13T09:38:55.000Z","size":2359,"stargazers_count":2198,"open_issues_count":24,"forks_count":159,"subscribers_count":34,"default_branch":"master","last_synced_at":"2024-10-29T17:57:30.150Z","etag":null,"topics":["empty","empty-state","loading","placeholder","state-management","uicollectionview","uitableview"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HamzaGhazouani.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"HamzaGhazouani"}},"created_at":"2017-07-21T14:56:34.000Z","updated_at":"2024-10-23T06:34:35.000Z","dependencies_parsed_at":"2022-07-15T13:47:02.162Z","dependency_job_id":null,"html_url":"https://github.com/HamzaGhazouani/HGPlaceholders","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HamzaGhazouani%2FHGPlaceholders","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HamzaGhazouani%2FHGPlaceholders/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HamzaGhazouani%2FHGPlaceholders/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HamzaGhazouani%2FHGPlaceholders/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HamzaGhazouani","download_url":"https://codeload.github.com/HamzaGhazouani/HGPlaceholders/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228454017,"owners_count":17922584,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["empty","empty-state","loading","placeholder","state-management","uicollectionview","uitableview"],"created_at":"2024-01-05T20:16:25.947Z","updated_at":"2024-12-09T16:31:14.407Z","avatar_url":"https://github.com/HamzaGhazouani.png","language":"Swift","funding_links":["https://github.com/sponsors/HamzaGhazouani"],"categories":["UI","Libs","HarmonyOS","Swift","Uncategorized","UI [🔝](#readme)","Content"],"sub_categories":["Table View / Collection View","UI","Windows Manager","Uncategorized","Other free courses","Table View"],"readme":"# HGPlaceholders\n\n[![Backers on Open Collective](https://opencollective.com/hgplaceholders/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/hgplaceholders/sponsors/badge.svg)](#sponsors) [![CI Status](http://img.shields.io/travis/HamzaGhazouani/HGPlaceholders.svg?style=flat)](https://travis-ci.org/HamzaGhazouani/HGPlaceholders)\n[![Version](https://img.shields.io/cocoapods/v/HGPlaceholders.svg?style=flat)](http://cocoapods.org/pods/HGPlaceholders)\n[![License](https://img.shields.io/cocoapods/l/HGPlaceholders.svg?style=flat)](http://cocoapods.org/pods/HGPlaceholders)\n[![Language](https://img.shields.io/badge/language-Swift-orange.svg?style=flat)]()\n[![Supports](https://img.shields.io/badge/supports-CocoaPods%20%7C%20Carthage-green.svg?style=flat)]()\n[![Platform](https://img.shields.io/cocoapods/p/HGPlaceholders.svg?style=flat)](http://cocoapods.org/pods/HGPlaceholders)\n\u003cbr /\u003e\n\n[![Twitter: @GhazouaniHamza](https://img.shields.io/badge/contact-@GhazouaniHamza-blue.svg?style=flat)](https://twitter.com/GhazouaniHamza)\n[![codebeat badge](https://codebeat.co/badges/c706606b-c02a-4000-af85-6cebf23c5538)](https://codebeat.co/projects/github-com-hamzaghazouani-hgplaceholders-master)\n[![Documentation](https://img.shields.io/cocoapods/metrics/doc-percent/HGPlaceholders.svg)](http://cocoadocs.org/docsets/HGPlaceholders/)\n[![Readme Score](http://readme-score-api.herokuapp.com/score.svg?url=https://github.com/hamzaghazouani/hgplaceholders/)](http://clayallsopp.github.io/readme-score?url=https://github.com/hamzaghazouani/hgplaceholders)\n\n## Example\n\n![](/Screenshots/default.gif) ![](/Screenshots/custom.gif)\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Requirements\n- iOS 8.0+\n- Xcode 9.2\n\n\n## You also may like\n\n* **[HGCircularSlider](https://github.com/HamzaGhazouani/HGCircularSlider)** - A custom reusable circular slider control for iOS application.\n* **[HGRippleRadarView](https://github.com/HamzaGhazouani/HGRippleRadarView)** - A beautiful radar view to show nearby users with ripple animation, fully customizable\n\n## Installation\n\nHGPlaceholders is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'HGPlaceholders'\n```\n\nHGPlaceholders is also available through [Carthage](https://github.com/Carthage/Carthage). To install\nit, simply add the following line to your Cartfile:\n\n``` ruby\ngithub \"HamzaGhazouani/HGPlaceholders\"\n```\n\n## Usage\n\n1. Inherit your UITableView class from TableView Or inherit UICollectionView from CollectionView\n2. Call the placeholder to show\n\n* `tableView.showLoadingPlaceholder()` or `collectionView.showLoadingPlaceholder()`\n* `tableView.showNoResultsPlaceholder()` or `collectionView.showNoResultsPlaceholder()`\n* `tableView.showErrorPlaceholder()` or `collectionView.showErrorPlaceholder()`\n* `tableView.showNoConnectionPlaceholder()` or `collectionView.showNoConnectionPlaceholder()`\n\n\n## Customization \n\nIf you want to change only images, just set them in your asset with this names (the framework check firstly in the main bundle): \n\n* loading    : \"hg_default-loading\"\n* no_connection    : \"hg_default-no_connection\"\n* no_results    : \"hg_default-no_results\"\n* error    : \"hg_default-error\"\n\n\n\nThe framework contains different defaults placeholders:\n\n* Basic    : \n\n`tableView.placeholdersProvider = .basic` or `collectionView.placeholdersProvider = .basic`\n\n* Default  : \n\n`tableView.placeholdersProvider = .default` or `collectionView.placeholdersProvider = .default` \n\n* Default2 : \n\n`tableView.placeholdersProvider = .default2` or `collectionView.placeholdersProvider = .default2` \n\n\n* Hallowen : \n\n`tableView.placeholdersProvider = .halloween` or `collectionView.placeholdersProvider = .halloween` // for fun :)` \n\nIf you want to change the default palceholders for all table views in your project: \n\n```swift\nclass ProjectNameTableView: TableView {\n\n    override func customSetup() {\n        placeholdersProvider = .basic\n    }\n}\n```\n\n```swift\nclass ProjectNameCollectionView: CollectionView {\n\n    override func customSetup() {\n        placeholdersProvider = .basic\n    }\n}\n```\n\nYou 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\n\n### Creating a new theme from scratch \n\n```swift\nstatic var summer: PlaceholdersProvider {\n        \n        var commonStyle = PlaceholderStyle()\n        commonStyle.backgroundColor = UIColor(red: 1.0, green: 236.0/255, blue: 209.0/255.0, alpha: 1.0)\n        commonStyle.actionBackgroundColor = .black\n        commonStyle.actionTitleColor = .white\n        commonStyle.titleColor = .black\n        commonStyle.isAnimated = false\n        \n        commonStyle.titleFont = UIFont(name: \"AvenirNextCondensed-HeavyItalic\", size: 19)!\n        commonStyle.subtitleFont = UIFont(name: \"AvenirNextCondensed-Italic\", size: 19)!\n        commonStyle.actionTitleFont = UIFont(name: \"AvenirNextCondensed-Heavy\", size: 19)!\n        \n        var loadingStyle = commonStyle\n        loadingStyle.actionBackgroundColor = .clear\n        loadingStyle.actionTitleColor = .gray\n        \n        var loadingData: PlaceholderData = .loading\n        loadingData.image = #imageLiteral(resourceName: \"summer-hat\")\n        let loading = Placeholder(data: loadingData, style: loadingStyle, key: .loadingKey)\n        \n        var errorData: PlaceholderData = .error\n        errorData.image = #imageLiteral(resourceName: \"summer-ball\")\n        let error = Placeholder(data: errorData, style: commonStyle, key: .errorKey)\n        \n        var noResultsData: PlaceholderData = .noResults\n        noResultsData.image = #imageLiteral(resourceName: \"summer-cocktail\")\n        let noResults = Placeholder(data: noResultsData, style: commonStyle, key: .noResultsKey)\n        \n        var noConnectionData: PlaceholderData = .noConnection\n        noConnectionData.image = #imageLiteral(resourceName: \"summer-beach-slippers\")\n        let noConnection = Placeholder(data: noConnectionData, style: commonStyle, key: .noConnectionKey)\n        \n        let placeholdersProvider = PlaceholdersProvider(loading: loading, error: error, noResults: noResults, noConnection: noConnection)\n        \n        let xibPlaceholder = Placeholder(cellIdentifier: \"CustomPlaceholderCell\", key: PlaceholderKey.custom(key: \"XIB\"))\n        \n        placeholdersProvider.add(placeholders: xibPlaceholder)\n        \n        return placeholdersProvider\n    }\n ```\n ### Adding a custom placeholder to an existing theme \n    \n ```swift \n    private static var starWarsPlaceholder: Placeholder {\n        var starwarsStyle = PlaceholderStyle()\n        starwarsStyle.backgroundColor = .black\n        starwarsStyle.actionBackgroundColor = .clear\n        starwarsStyle.actionTitleColor = .white\n        starwarsStyle.titleColor = .white\n        starwarsStyle.isAnimated = false\n        \n        var starwarsData = PlaceholderData()\n        starwarsData.title = NSLocalizedString(\"\\\"This is a new day, a\\nnew beginning\\\"\", comment: \"\")\n        starwarsData.subtitle = NSLocalizedString(\"Star Wars\", comment: \"\")\n        starwarsData.image = #imageLiteral(resourceName: \"star_wars\")\n        starwarsData.action = NSLocalizedString(\"OK!\", comment: \"\")\n        \n        let placeholder = Placeholder(data: starwarsData, style: starwarsStyle, key: PlaceholderKey.custom(key: \"starWars\"))\n        \n        return placeholder\n    }\n    \n    let provider = PlaceholdersProvider.summer \n    provider.addPlaceholders(MyUtilityClass.starWarsPlaceholder) \n```\n\n\n## Documentation\nFull documentation is available on [CocoaDocs](http://cocoadocs.org/docsets/HGPlaceholders/).\u003cbr/\u003e\nYou can also install documentation locally using [jazzy](https://github.com/realm/jazzy).\n\n## Author\n\nHamza Ghazouani, hamza.ghazouani@gmail.com\n\n## License\n\nHGPlaceholders is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHamzaGhazouani%2FHGPlaceholders","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHamzaGhazouani%2FHGPlaceholders","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHamzaGhazouani%2FHGPlaceholders/lists"}