{"id":20936508,"url":"https://github.com/eneskaraosman/swiftemptystate","last_synced_at":"2025-09-02T12:45:37.840Z","repository":{"id":62456466,"uuid":"242947171","full_name":"EnesKaraosman/SwiftEmptyState","owner":"EnesKaraosman","description":"Displaying Empty state of a page. (UIKit)","archived":false,"fork":false,"pushed_at":"2020-02-28T07:41:17.000Z","size":3797,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T05:24:08.465Z","etag":null,"topics":["cocoapods","empty-state","ios","swift","swiftpackagemanager"],"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/EnesKaraosman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-25T08:22:57.000Z","updated_at":"2024-09-10T09:31:10.000Z","dependencies_parsed_at":"2022-11-01T22:46:23.314Z","dependency_job_id":null,"html_url":"https://github.com/EnesKaraosman/SwiftEmptyState","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnesKaraosman%2FSwiftEmptyState","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnesKaraosman%2FSwiftEmptyState/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnesKaraosman%2FSwiftEmptyState/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnesKaraosman%2FSwiftEmptyState/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EnesKaraosman","download_url":"https://codeload.github.com/EnesKaraosman/SwiftEmptyState/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254030933,"owners_count":22002674,"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":["cocoapods","empty-state","ios","swift","swiftpackagemanager"],"created_at":"2024-11-18T22:20:17.251Z","updated_at":"2025-05-13T21:31:06.830Z","avatar_url":"https://github.com/EnesKaraosman.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftEmptyState\n\n[![CI Status](https://img.shields.io/travis/eneskaraosman/SwiftEmptyState.svg?style=flat)](https://travis-ci.org/eneskaraosman/SwiftEmptyState)\n[![Version](https://img.shields.io/cocoapods/v/SwiftEmptyState.svg?style=flat)](https://cocoapods.org/pods/SwiftEmptyState)\n[![License](https://img.shields.io/cocoapods/l/SwiftEmptyState.svg?style=flat)](https://cocoapods.org/pods/SwiftEmptyState)\n[![Platform](https://img.shields.io/cocoapods/p/SwiftEmptyState.svg?style=flat)](https://cocoapods.org/pods/SwiftEmptyState)\n\n## Demo\n![](https://github.com/EnesKaraosman/SwiftEmptyState/blob/master/Example/SwiftEmptyState/emptyStateDemo.gif)\n\n## Why do I need?\n\nCommon usage case;\n\n**TLDR**;\u003cbr/\u003e \nImage you're getting data from a backend, your request succeded but it is just an empty list.\nDon't left user with a blank screen, or boring alerts.\n\n[Display Empty State - Medium Blog](https://medium.com/mobiletech/display-empty-state-of-a-page-in-ios-aa2430ac7d58)\n\n## Usage\n\nFor better understanding, please view Example project.\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\nBut here below the main concept.\n\nUsable in any `UITableViewController`, `UICollectionViewController` and `UIViewController`\n\n\n```swift\n\nclass TableViewController: UITableViewController {\n    \n    lazy var emptyStateManager: EmptyStateManager = {\n        \n        let esv = EmptyStateView(\n            messageText: \"This is label belongs to empty state view that sits in UITableViewController's UITableView\",\n            titleText: \"EmptyState Title\",\n            image: UIImage(named: \"empty_state_image\"),\n            buttonText: \"Button\",\n            centerYOffset: -100 // In case you want to move it to top, by default it is centered (offset = 0)\n        )\n        esv.buttonAction = { _ in\n            esv.messageText = \"Button action works 👍🏻\"\n        }\n        \n        let manager = EmptyStateManager(\n            containerView: self.tableView,\n            emptyView: esv,\n            animationConfiguration: .init(animationType: .spring)\n        )\n        return manager\n    }()\n    \n    var dataSource = (1...50).map { _ in UIColor.random } {\n        didSet {\n            self.tableView.reloadData()\n            self.emptyStateManager.reloadState()\n        }\n    }\n    \n    // dataSource is the dataSource of tableView\n}\n```\n\nSame example valid for UICollectionView contentView, \u003cbr/\u003e\nIf your content view is subclass of `ICollectionView/UITableView` \u003cbr/\u003e\nmanager knows whether it hasContent, but in case you use pure UIView as contentView \u003cbr/\u003e\nthen make sure you set hasContent manually.\n\n```swift\nmanager.hasContent = {\n    !self.dataSource.isEmpty\n}\n```\n\n## Animation\n\n`EmptyStateManager` has animationConfiguration parameter with default values.\n\n```swift\nstruct AnimationConfiguration {\n    let animationType: AnimationType     // .spring, .fromBottom, .fromLeft, .fromTop, .fromRight\n    let animationDuration: TimeInterval\n    let subItemDelayConstant: Double     // image, titleLabel, messageLabel, button. Except .spring animation\n    let springDamping: CGFloat           // .spring animation case\n    let initialVelocity: CGFloat\n    let options: UIView.AnimationOptions\n}\n\nlet manager = EmptyStateManager(\n    containerView: ***,\n    emptyView: ***,\n    animationConfiguration: .init(animationType: .spring)\n)\n```\n\n## Customization\n\nIf you want to make your custom EmptyStateView \u003cbr/\u003e\nJust implement `IEmptyStateView` protocol in your custom UIView class.\n\n## Requirements\niOS 10+\nSwift 5+\n\n## Installation\n\n#### Pod\nSwiftEmptyState is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'SwiftEmptyState'\n```\n\n#### Package Manager\nAdd new package from repository link: https://github.com/EnesKaraosman/SwiftEmptyState.git\n\n## Author\n\neneskaraosman, eneskaraosman53@gmail.com\n\n## License\n\nSwiftEmptyState 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%2Feneskaraosman%2Fswiftemptystate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feneskaraosman%2Fswiftemptystate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feneskaraosman%2Fswiftemptystate/lists"}