A SwiftUI List Picker to replace system Picker in List

Overview

BetterListPicker

An alternative customizable list picker in order to replace built-in non customizable Picker when we write settings view codes.

Demo

Demo GIF

Requirements

iOS 14.0+, macOS 11.0+, watchOS 7.0+, tvOS 14.0+

Installation

Swift Package Manager (Recommended)

  • Xcode > File > Swift Packages > Add Package Dependency
  • Add https://github.com/Jinya/BetterListPicker.git
  • Select "Exact Version" (recommend using the latest exact version)

How to Use

Sample codes, see more in Demo App...

import SwiftUI
import BetterListPicker

enum Framework: String, CaseIterable {
    case appkit = "AppKit"
    case uikit = "UIKit"
    case swiftui = "SwiftUI"
}

extension Framework: BetterListPickerValuable {
    var id: String { self.rawValue }
    var titleKey: LocalizedStringKey { LocalizedStringKey(self.rawValue) }
}

struct ContentView: View {

    @State var favorite: Framework = .swiftui

    var body: some View {
        NavigationView {
            List {
                Section {
                    BetterListPicker("Favorite",
                                     selectionValue: $favorite,
                                     pickerValues: Framework.allCases)

                    BetterListPicker("Favorite",
                                     selectionValue: $favorite,
                                     pickerValues: Framework.allCases,
                                     pickerListSectionHeader: { Text("Header") },
                                     pickerListSectionFooter: { EmptyView() })

                    BetterListPicker($favorite,
                                     pickerValues: Framework.allCases) {
                        Text("Custom Navigation Title")
                    } pickerListSectionFooter: {
                        Text("Footer")
                    } label: {
                        Label("Favorite", systemImage: "star.circle")
                    }

                    BetterListPicker($favorite,
                                     pickerValues: Framework.allCases) {
                        Text("Custom Navigation Title 2")
                    } pickerListSectionHeader: {
                        Text("Header")
                    } pickerListSectionFooter: {
                        Text("Footer")
                    } label: {
                        VStack(alignment: .leading) {
                            Text("Favorite")
                            Text("Choose the favorite framework")
                                .font(.footnote)
                        }
                    }
                } header: {
                    Text("BetterListPicker")
                } footer: {
                    Text("And more customizable features...")
                }
            }
            .navigationTitle("Picker Demo")
        }
    }
}

MIT License

BetterListPicker released under the MIT license. See LICENSE for details.

You might also like...
MICountryPicker is a country picker controller for iOS8+ with an option to search.
MICountryPicker is a country picker controller for iOS8+ with an option to search.

MICountryPicker MICountryPicker is a country picker controller for iOS8+ with an option to search. The list of countries is based on the ISO 3166 coun

A simple, customizable Country picker for picking country or dialing code. 🇮🇳 🇯🇵 🇰🇷 🇩🇪 🇨🇳 🇺🇸 🇫🇷 🇪🇸 🇮🇹 🇷🇺 🇬🇧
A drop in single image picker.

PHSingleImagePicker A low memory, single image picker wrapper that provide a significant smaller file size while also preserve high image quality. Int

A simple yet customizable horizontal and vertical picker view
A simple yet customizable horizontal and vertical picker view

WheelPicker A simple yet customizable horizontal and vertical picker view Features Vertical or Horizontal picker Image or Text data Configure UILabel

React-native-place-picker: Pick any place with single click 🚀
React-native-place-picker: Pick any place with single click 🚀

React-native-place-picker: Pick any place with single click 🚀

LocationPicker - A ready for use and fully customizable location picker for your app
LocationPicker - A ready for use and fully customizable location picker for your app

LocationPicker A ready for use and fully customizable location picker for your app. Features Installation Cocoapods Carthage Swift Package Manager Qui

 🤯 PickEmoji: A SwiftUI Extension to Pick the Emojis that you wish
🤯 PickEmoji: A SwiftUI Extension to Pick the Emojis that you wish

🤯 PickEmoji: A SwiftUI Extension to Pick the Emojis that you wish You can use this library in your projects 🙃 . You can search the emojis too. Below

Replace the system volume popup with a more subtle indicator.
Replace the system volume popup with a more subtle indicator.

Replace the volume popup with a more subtle way to display the volume when the user changes it with the volume rocker. Why and how The iOS default pop

A set of libraries to help users find and replace native system emojis with EmojiOne in their app or website.
A set of libraries to help users find and replace native system emojis with EmojiOne in their app or website.

This repository is now maintained as JoyPixels/emoji-toolkit. You'll find the latest version of our resources at emoji-toolkit. Please see the UPGRADE

System Color Picker - The macOS color picker as an app with more features
System Color Picker - The macOS color picker as an app with more features

System Color Picker The macOS color picker as an app with more features Download Requires macOS 11 or later. Features Quickly copy, paste, and convert

CHIPageControl is a set of cool animated page controls to replace boring UIPageControl.
CHIPageControl is a set of cool animated page controls to replace boring UIPageControl.

CHIPageControl is a set of cool animated page controls to replace boring UIPageControl. We were inspired by Jardson Almeida dribbble sh

Replace your Xcode icon with colorful variants
Replace your Xcode icon with colorful variants

XcoatOfPaint Have you ever wished the Xcode icon could get a fresh coat of paint to match the colorful Mac you just bought? Or you want to distinguish

Phimp.me - Photo Image Editor and Sharing App. Phimp.me is a Photo App for iOS that aims to replace proprietary photo applications. It offers features such as taking photos, adding filters, editing images and uploading them to social networks. This is a selection of custom page controls to replace UIPageControl
This is a selection of custom page controls to replace UIPageControl

PageControls This is a selection of custom page controls to replace UIPageControl, inspired by a dribbble found here. The appearance (color, size, # o

A better SwiftUI Picker Use _Picker instead of Picker

BetterPicker A better SwiftUI Picker. Use _Picker instead of Picker. Create styles with _PickerStyle. The is a WIP This library is currently a work-in

Swift-picker-views - inline single and multi picker views for UIKit. Without tableview! Easy and simple
Swift-picker-views - inline single and multi picker views for UIKit. Without tableview! Easy and simple

swift-picker-views Inline single and multiple picker views for UIKit. No tablevi

Swift library that makes easier to serialize the user's preferences (app's settings) with system User Defaults or Property List file on disk.

PersistentStorageSerializable PersistentStorageSerializable is a protocol for automatic serialization and deserialization of Swift class, struct or NS

Orbit-swiftui - Orbit design system implemented in SwiftUI for iOS

Orbit is a SwiftUI component library which provides developers the easiest possi

CarListing app allows user to see list of cars on map as well as in the list

Car Listing CarListing app allows user to see list of cars on map as well as in the list. Features See List of cars on map in the home screen. User ca

Releases(0.2.0)
Owner
Jinya
Absorb Objective-C, React Native and Swift... Now a SwiftUI enthusiast.
Jinya
Multi-picker for iOS and Mac available in SwiftUI

Multi-picker for iOS and Mac available in Swift UI

1amageek 5 Jul 12, 2022
iOS/macOS media picker for importing images and videos in SwiftUI

iOS/macOS media picker for importing images and videos in SwiftUI.

Mobile Development Club 13 Dec 30, 2022
A SwiftUI implementation of a picker that also allows direct input.

ComboPicker ComboPicker is a SwiftUI view that allows users to input a value by selecting from a predefined set or by typing a custom one. Installatio

Alessio Moiso 5 Sep 13, 2022
FYPhoto is a photo/video picker and image browser library for iOS written in pure Swift. It is feature-rich and highly customizable to match your App's requirements.

FYPhoto is a photo/video picker and image browser library for iOS written in pure Swift. It is feature-rich and highly customizable to match your App's requirements.

null 10 Dec 11, 2022
Date picker dialog for iOS

DatePickerDialog 4.0 - iOS - Swift DatePickerDialog is an iOS drop-in classe that displays an UIDatePicker within an UIAlertView. Requirements DatePic

Squimer 535 Dec 17, 2022
a picker view shown as a popup for iOS in Objective-C

CZPicker Demo Change Log 3 most recent changes are listed here. Full change logs v0.4.3 - 2016-08-12 Added - (void)czpickerViewWillDisplay:(CZPickerVi

Chen Zeyu 527 Oct 2, 2022
🎯 Swift country and phone code Picker

CountryPicker Picker code Swift 3 / 4 / 5. Example To run the example project, clone the repo, and run pod install from the Example directory first. U

null 207 Dec 22, 2022
An iOS picker view to serve all your "picking" needs

Mandoline The PickerView is a UICollectionView that provides a smooth "picking" interface. In order to get the most out of it, a consuming view contro

Blue Apron 883 Nov 28, 2022
Elegant and Easy-to-Use iOS Swift Date Picker

D2PDatePicker Example To run the example project, clone the repo, and run pod install from the Example directory first. Example Code: Programmatical I

Pradheep Rajendirane 292 Nov 6, 2022
A country picker view controller for iOS

Planet A country picker view controller for iOS. Installation CocoaPods You can use CocoaPods to install Planet by adding it to your Podfile: platform

kWallet 71 Jul 11, 2022