All Projects → HamzaGhazouani → Hgplaceholders

HamzaGhazouani / Hgplaceholders

Licence: mit
Nice library to show placeholders and Empty States for any UITableView/UICollectionView in your project

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Hgplaceholders

Skeletonview
☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
Stars: ✭ 10,804 (+427.54%)
Mutual labels:  loading, uicollectionview, uitableview, placeholder
Statefulviewcontroller
Placeholder views based on content, loading, error or empty states
Stars: ✭ 2,139 (+4.44%)
Mutual labels:  state-management, loading, placeholder, empty
Tabanimated
A skeleton screen framework based on native for iOS. (一个由iOS原生组件映射出骨架屏的框架,包含快速植入,低耦合,兼容复杂视图等特点,提供国内主流骨架屏动画的加载方案,同时支持上拉加载更多、自定制动画。)
Stars: ✭ 2,909 (+42.04%)
Mutual labels:  loading, uicollectionview, uitableview, placeholder
PageStatusTransformer
A low invasive state management on Android
Stars: ✭ 12 (-99.41%)
Mutual labels:  state-management, loading, empty
Cyanic
Declarative, state-driven UI framework
Stars: ✭ 32 (-98.44%)
Mutual labels:  state-management, uitableview, uicollectionview
HDEmptyView
一个Swift语言封装的EmptyView显示库,可作用于WKWebView、UITableView、UICollectionView 无网络提醒或者空数据提醒
Stars: ✭ 29 (-98.58%)
Mutual labels:  uitableview, uicollectionview, empty
Wlemptystate
WLEmptyState is an iOS based component that lets you customize the view when the dataset of a UITableView or a UICollectionView is empty. We created a sample project with the WLEmptyState component to show how you can use it.
Stars: ✭ 305 (-85.11%)
Mutual labels:  uicollectionview, uitableview, placeholder
Viewanimator
ViewAnimator brings your UI to life with just one line
Stars: ✭ 6,592 (+221.88%)
Mutual labels:  uicollectionview, uitableview
Changeset
Minimal edits from one collection to another
Stars: ✭ 807 (-60.6%)
Mutual labels:  uicollectionview, uitableview
Tangramkit
TangramKit is a powerful iOS UI framework implemented by Swift. It integrates the functions with Android layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,LayoutSizeClass to build your App 自动布局 UIView UITableView UICollectionView
Stars: ✭ 984 (-51.95%)
Mutual labels:  uicollectionview, uitableview
Carbon
🚴 A declarative library for building component-based user interfaces in UITableView and UICollectionView.
Stars: ✭ 1,034 (-49.51%)
Mutual labels:  uicollectionview, uitableview
Vue Content Loading
Vue component to easily build (or use presets) SVG loading cards Facebook like.
Stars: ✭ 729 (-64.4%)
Mutual labels:  loading, placeholder
Flix
iOS reusable form library in Swift.
Stars: ✭ 725 (-64.6%)
Mutual labels:  uicollectionview, uitableview
Thinningcoordinator
The UITableView/UICollectionView dataSource/delegate thinning coordinator, help thinning your UIViewController!
Stars: ✭ 25 (-98.78%)
Mutual labels:  uicollectionview, uitableview
Tysnapshotscroll
一句代码保存截图,将 UIScrollView UITableView UICollectionView UIWebView WKWebView 网页 保存 为 长图 查看。Save the scroll view page as an image,support UIScrollView,UITableView,UICollectionView,UIWebView,WKWebView.(Support iOS13)
Stars: ✭ 709 (-65.38%)
Mutual labels:  uicollectionview, uitableview
Pagingkit
PagingKit provides customizable menu UI. It has more flexible layout and design than the other libraries.
Stars: ✭ 1,030 (-49.71%)
Mutual labels:  uicollectionview, uitableview
Gltablecollectionview
Netflix and App Store like UITableView with UICollectionView, written in pure Swift 4.2
Stars: ✭ 709 (-65.38%)
Mutual labels:  uicollectionview, uitableview
Ssplaceholdertableview
SSPlaceholderTableView is Placeholder Library for different different state wise placeHolder for UITableView/UICollectionView. Check https://www.cocoacontrols.com/controls/ssplaceholdertableview
Stars: ✭ 39 (-98.1%)
Mutual labels:  uicollectionview, placeholder
Placeholder Loading
Simple and flexible, css only, content placeholder loading animation. https://zalog.github.io/placeholder-loading/
Stars: ✭ 1,137 (-44.48%)
Mutual labels:  loading, placeholder
Gskstretchyheaderview
A generic stretchy header for UITableView and UICollectionView
Stars: ✭ 1,624 (-20.7%)
Mutual labels:  uicollectionview, uitableview

HGPlaceholders

Backers on Open Collective Sponsors on Open Collective CI Status Version License Language Supports Platform

Twitter: @GhazouaniHamza codebeat badge Documentation Readme Score

Example

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.
  • HGRippleRadarView - A beautiful radar view to show nearby users with ripple animation, fully customizable

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

Creating a new theme from scratch

static var summer: PlaceholdersProvider {
        
        var commonStyle = PlaceholderStyle()
        commonStyle.backgroundColor = UIColor(red: 1.0, green: 236.0/255, blue: 209.0/255.0, alpha: 1.0)
        commonStyle.actionBackgroundColor = .black
        commonStyle.actionTitleColor = .white
        commonStyle.titleColor = .black
        commonStyle.isAnimated = false
        
        commonStyle.titleFont = UIFont(name: "AvenirNextCondensed-HeavyItalic", size: 19)!
        commonStyle.subtitleFont = UIFont(name: "AvenirNextCondensed-Italic", size: 19)!
        commonStyle.actionTitleFont = UIFont(name: "AvenirNextCondensed-Heavy", size: 19)!
        
        var loadingStyle = commonStyle
        loadingStyle.actionBackgroundColor = .clear
        loadingStyle.actionTitleColor = .gray
        
        var loadingData: PlaceholderData = .loading
        loadingData.image = #imageLiteral(resourceName: "summer-hat")
        let loading = Placeholder(data: loadingData, style: loadingStyle, key: .loadingKey)
        
        var errorData: PlaceholderData = .error
        errorData.image = #imageLiteral(resourceName: "summer-ball")
        let error = Placeholder(data: errorData, style: commonStyle, key: .errorKey)
        
        var noResultsData: PlaceholderData = .noResults
        noResultsData.image = #imageLiteral(resourceName: "summer-cocktail")
        let noResults = Placeholder(data: noResultsData, style: commonStyle, key: .noResultsKey)
        
        var noConnectionData: PlaceholderData = .noConnection
        noConnectionData.image = #imageLiteral(resourceName: "summer-beach-slippers")
        let noConnection = Placeholder(data: noConnectionData, style: commonStyle, key: .noConnectionKey)
        
        let placeholdersProvider = PlaceholdersProvider(loading: loading, error: error, noResults: noResults, noConnection: noConnection)
        
        let xibPlaceholder = Placeholder(cellIdentifier: "CustomPlaceholderCell", key: PlaceholderKey.custom(key: "XIB"))
        
        placeholdersProvider.add(placeholders: xibPlaceholder)
        
        return placeholdersProvider
    }

Adding a custom placeholder to an existing theme

   private static var starWarsPlaceholder: Placeholder {
       var starwarsStyle = PlaceholderStyle()
       starwarsStyle.backgroundColor = .black
       starwarsStyle.actionBackgroundColor = .clear
       starwarsStyle.actionTitleColor = .white
       starwarsStyle.titleColor = .white
       starwarsStyle.isAnimated = false
       
       var starwarsData = PlaceholderData()
       starwarsData.title = NSLocalizedString("\"This is a new day, a\nnew beginning\"", comment: "")
       starwarsData.subtitle = NSLocalizedString("Star Wars", comment: "")
       starwarsData.image = #imageLiteral(resourceName: "star_wars")
       starwarsData.action = NSLocalizedString("OK!", comment: "")
       
       let placeholder = Placeholder(data: starwarsData, style: starwarsStyle, key: PlaceholderKey.custom(key: "starWars"))
       
       return placeholder
   }
   
   let provider = PlaceholdersProvider.summer 
   provider.addPlaceholders(MyUtilityClass.starWarsPlaceholder) 

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].