
DZNEmptyDataSet
An Objective-C add-on that shows a placeholder message when an iOS table or collection view is empty.
- Stars
- 12k
- Forks
- 1.7k
- Licence
- MIT
- Language
- Objective-C
- Last update
- 4.3 years ago
- Type
- Library
This repository is archived and no longer maintained.
What it is
DZNEmptyDataSet is a library for iOS apps that adds an empty-state screen to UITableView and UICollectionView. When a list has no content, it can display an image, title, description, button, or custom view in place of a blank screen. Developers use it to explain why a screen is empty and to guide users on what to do next.
- Show a 'Please Allow Photo Access' message with a button when a photo list is empty
- Display a loading spinner as a custom view while a table waits for data
- Hide the empty state conditionally with emptyDataSetShouldDisplay
- Add a tap gesture to the whole table area to dismiss the keyboard
Great for
- iOS developers maintaining Objective-C apps that show lists
- Teams who want empty-state messages without subclassing UITableView or UICollectionView
- Developers adding onboarding prompts to screens that start out empty
- Projects that use Storyboards or UITableViewController
Not ideal for
- Teams building new apps in Swift who want a maintained, current library: the project is archived and its last push was 2022-07-06
- Developers working outside iOS, tvOS, or Apple platforms, since it is built for UIKit
- Anyone needing a Swift-first API: the README's examples are Objective-C
How to get it
- 1
Install with a package manager
You'll need: Xcode · CocoaPods, Carthage, or Swift Package Manager
CocoaPods: add to Podfile
pod 'DZNEmptyDataSet' - 2
Run it
- Add the library with CocoaPods, Carthage, or Swift Package Manager.
- Import UIScrollView+EmptyDataSet.h in your view controller.
- Conform your controller to DZNEmptyDataSetSource and DZNEmptyDataSetDelegate.
- Set emptyDataSetSource and emptyDataSetDelegate on your table or collection view.
- Implement the data source methods such as titleForEmptyDataSet to return content.
- 3
Get the most out of it
- Use NSAttributedString attributes to style the title and description text
- Return a custom view from customViewForEmptyDataSet for more complex layouts
- Use verticalOffsetForEmptyDataSet to adjust placement when a table header view is visible
- Use spaceHeightForEmptyDataSet to change spacing between the image, title, description, and button
- Implement emptyDataSetShouldDisplay to control when the empty state appears
Downloads
Strengths
- Works with UITableViewController and UICollectionViewController without subclassing
- Text styling uses standard NSAttributedString, so it is familiar to iOS developers
- Configuration is done by conforming to data source and delegate protocols
Trade-offs
- The repository is archived, so no new fixes or iOS version support are expected from the maintainer
- The README's examples are Objective-C and the Swift branch is referenced only as a sample project
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.