Skip to content

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

License

Notifications You must be signed in to change notification settings

Toni77777/EmptyList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.