Skip to content

Toni77777/EmptyList

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

EmptyList

Swift 5 Platforms Version License: MIT

EmptyList - List(SwiftUI) supports displaying Empty ListView for empty state

Usage

EmptyList(countries, listRowView: { country in
    Text(country.name)
}, emptyListView: {
    Text("No countries") // View displayed when the items collection isEmpty
})

// Source data for List. Source item must implement Identifiable protocol
struct Country: Identifiable {
    let id: UUID
    let name: String
}

// Source data items for List 
let countries: [Country] = [
    Country(id: UUID(), name: "Poland"),
    Country(id: UUID(), name: "Germany")
    /// Others countries 
]

Example

Look here if need more details

Requirements

  • Xcode 11+
  • Swift 5.2+

And same requirements how to use SwiftUI. Availability:

  • iOS 13.0+
  • macOS 10.15+
  • Mac Catalyst 13.0+
  • tvOS 13.0+
  • watchOS 6.0+

Installation

Feel free copy-paste EmptyList to your project or can install via CocoaPods. For installation through CocoaPods add the following line to your Podfile:

pod 'EmptyList', '~> 1.0.0'

License

EmptyList is available under the MIT license. See the LICENSE file for more info.