SwiftUIIndexedList - Add an index bar to a SwiftUI List or ScrollView

Overview

SwiftUIIndexedList

Add an index bar to a SwiftUI List or ScrollView.

Preview

Getting Started

Conform your data source to Indexable and Identifiable. Then replace List with IndexedList, or ScrollView with IndexedScrollView:

IndexedList(data) { element in
    Section {
        //Your section content
    } header: {
        //Your header content
            .id(element.id)
    }
}

Overview

Index

struct · A type that describes the appearance and behaviour of data in an index bar.

  • contentID: The identifier of the view to scroll to.
  • displayPriority: The display priority of the label. The system may consider the display priority during the layout of a truncated index bar.
    • standard: The standard display priority.
    • increased: The increased display priority. An increased priority does not guarantee the label will be displayed.
  • title, image and systemImage: The parameters used to construct the label.

Indexable

protocol · A type that can be displayed in an index bar.

  • index: The appearance and behaviour in an index bar.

IndexedList

view · A container that presents rows of data arranged in a single column.

Construct the indices and the list content manually, or provide data that conforms to Indexable along with ElementContent for each element.

  • accessory: The scroll accessory to display in front of the list.
  • selection: A binding that identifies selected rows.

IndexedScrollView

view · A scrollable view.

Construct the indices and the scroll view's content manually, or provide data that conforms to Indexable along with ElementContent for each element.

  • accessory: The scroll accessory to display in front of the scroll view.

ScrollAccessory

enum · A scroll accessory displayed in front of a scrolling view.

  • automatic: An index bar, or an interactive scroll indicator when no indices are provided.
  • indexBar: An index bar.
  • scrollIndicator: An interactive scroll indicator.
  • none: No scroll accessory.

Additional Features

.indexBarBackground

view modifier · Content to layer behind any index bar within this view.

  • contentMode: Defines how the content fills the available space of the index bar.
  • content: The background content.

indexBarInsets

environment value · The edge insets of the index bar in the scrolling container view.

Requirements

  • iOS 14.0+
  • Xcode 13.0+

Installation

Contact

@ciaranrobrien on Twitter.

You might also like...
Shows a Pokémon list with its image and name with SwiftUI
Shows a Pokémon list with its image and name with SwiftUI

TelepassDigitalTestIB Description General This project aims to develop an app, for Telepass interview process, that shows a Pokémon list with its imag

Todo list with SwiftUI

TodoList.Capstone Todo list with SwiftUI i did is a Todo-List you can create a new todo by providing its name and description and the deadline of the

SwiftUI movies list using The Movie Database (TMDB) API

MyMoviesList About MyMovieList is an application that uses The Movie Database (TMDB) API and is built with SwiftUI. It demo of some SwiftUI (& Combine

Workaround to hide/modify List separators in SwiftUI iOS13 and iOS14
Workaround to hide/modify List separators in SwiftUI iOS13 and iOS14

Help support my open source work! iOS15 List finally supports setting list row separator color and style as of iOS15! They still don't support list in

Pull to refresh in SwiftUI for List, NavigationView
Pull to refresh in SwiftUI for List, NavigationView

SwiftUI-PullToRefresh Pull to refresh implementation in SwiftUI for List and NavigationView This article helped me a lot: https://swiftui-lab.com/scro

Aplikasi iOS Advanced Level To Do List dengan Firebase Auth, SwiftUI, MVVM Design Pattern, dan Firebase Firestore

Aplikasi Tasker adalah aplikasi iOS To Do List yang dibuat menggunakan Autentikasi Firebase / Firestore dan MVVM Design Pattern.

SaaS Dashboard App UI With Stylish Bar Graphs using SwiftUi 3.0 🤓
SaaS Dashboard App UI With Stylish Bar Graphs using SwiftUi 3.0 🤓

SaaS Dashboard UI SaaS Dashboard App UI With Stylish Bar Graphs using SwiftUi 3.0 🤓 Video Preview Screenshots Features Custom Bar Graph Custom Tab Ba

Add a software notch to your outdated Macbook! Deceive strangers!
Add a software notch to your outdated Macbook! Deceive strangers!

The Notch Draws a persistent little cutout out at the top of the screen, on top of everything else. Purpose Each year when Apple releases a new Macboo

MapApp - You can save the location of the places you go on the map and add names and notes
MapApp - You can save the location of the places you go on the map and add names and notes

MapApp - You can save the location of the places you go on the map and add names and notes

Owner
Ciaran O'Brien
Ciaran O'Brien
A set of SwiftUI custom modifiers to make the ScrollView snappable.

Snappable A set of SwiftUI custom modifiers to make the ScrollView snappable. The goal of this library is to provide an easy way to implement Views su

hugehoge 22 Nov 30, 2022
iOS App to display game lists and details with the ability to add games to your favorites list and see metacritic ratings.

Game Data System - GDS Author: Heitor Silveira ([email protected]) iOS App to view games from various platforms, their description, release

Heitor Ugarte Calvet da Silveira 0 Oct 6, 2021
Todo-list - Simple todo list app written in Swift

About TodoApp TodoApp is sinmple todo list app that I created in my free time, i

null 2 Aug 30, 2022
How to add Keyboard Shortcuts to any SwiftUI App with UIKeyCommand

SwiftUI-Keyboard-Demo This tiny project was built to show how simple it is to add keyboard shortcuts (with UIKeyCommand) to any SwiftUI app. After imp

Emmanuel Crouvisier 29 Jul 13, 2022
A SwiftUI wrapper around the `Add to Siri` button used to donate INIntents to the system.

AddToSiri A SwiftUI wrapper around the Add to Siri button used to donate INIntents to the system. Originally created by Reddit user u/dippnerd (Github

Florian Schweizer 5 Nov 23, 2022
An example to-do list app using SwiftUI which is introduced in WWDC19

SwiftUITodo SwiftUITodo is an example to-do list application using SwiftUI which is first introduced in WWDC19 keynote. Requirements Xcode 11 Beta Swi

Suyeol Jeon 701 Dec 23, 2022
Basic Todo list application built using the new SwiftUI framework and Core Data

Dub Dub Do - A sample TODO List Application in SwiftUI Updated for Xcode 11.5 This is a basic app that lets you create a list of todos, mark them as i

Stephen McMillan 67 Sep 28, 2022
A to-do list app using SwiftUI and combine with restful api.

Todo Combine SwiftUI It's an experiment project for the brand new SwiftUI + Combine + restful API with dark mode Build follow restfult to-do-api to ru

jamfly 14 Feb 21, 2022
In this mini app covered the concepts like basics of SwiftUI and Navigations and Animations and List with CRUD functions and MVVM and App Launch and App icons adding and also applied persistence using UserDefaults Concept.

TodoList In this application used the concepts from the beginner level project of SwiftUI_Evolve_1 The following concepts covered in this mini app Swi

Sivaram Yadav 2 Dec 4, 2021