Skip to content

EmptyDataView enables you to show user-friendly views when table data is empty.

License

Notifications You must be signed in to change notification settings

cat13954/EmptyDataView

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EmptyDataView

EmptyDataView enables you to show user friendly views when table data is empty.

MIT license Swift Compatibility Platform Compatibility

Installation

Swift Package Manager

To integrate using Apple's Swift Package Manager:

  • File > Swift Packages > Add Package Dependency
  • Add https://github.com/anup-deshpande/EmptyDataView.git

How to use

import EmptyDataView
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        
    // Load empty data view if table data is empty
    if colorList.isEmpty{
        tableView.setEmptyDataView(image: UIImage(systemName: "paintpalette")!, title: "No colors in the palette")
    }else{
        tableView.removeEmptyDataView()
    }
        
    return colorList.count
}

Note - If you are using separator style, please make sure to set it to none.

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        
    // Load empty data view if table data is empty
    if colorList.isEmpty{
        tableView.separatorStyle = .none
        tableView.setEmptyDataView(image: UIImage(systemName: "paintpalette")!, title: "No colors in the palette")
    }else{
        tableView.separatorStyle = .singleLine
        tableView.removeEmptyDataView()
    }
        
    return colorList.count
}

About

EmptyDataView enables you to show user-friendly views when table data is empty.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 100.0%