Skip to content

sbertix/SystemImagePicker

Repository files navigation

SystemImagePicker

Swift iOS macOS watchOS visionOS

SystemImagePicker is a SwiftUI View providing a cross-platform and highly customizable Picker-like component for selecting SF Symbols.

Installation

Swift Package Manager (Xcode 11 and above)

  1. Select File/Swift Packages/Add Package Dependency… from the menu.
  2. Paste https://github.com/sbertix/SystemImagePicker.git.
  3. Follow the steps.

Usage

The easiest way to present the Picker is through the provided View extension methods.

struct SomeView: View {
    @State private var isPresentingSymbols: Bool = false
    @State private var symbol: String?
    
    var body: some View {    
        Button("Choose a SF Symbol") { 
            isPresentingSymbols = true 
        }.systemImagePicker(
            isPresented: $isPresentingSymbols, 
            selection: $symbol
        )
    }
 }

But you can also initialize SystemImagePicker directly.

Features

SystemImagePicker supports the widest variety of features of any SF Symbols picker.

  • Sectioned and un-sectioned SF Symbols
  • Defaults for both sectioned and un-sectioned pickers
  • Filter or pass your own subset of SF Symbols to pick from
  • Support both precise and human readable search (e.g. "circle.fill" returns only circle.fill, but "circle fill" or "fill circle" returns all SF Symbols having a combination of both words)
  • Dismiss automatically on selection or wait for user input with .systemImagePickerDismissOnSelection(false)
  • Allow for no selection using Optionals
  • Pixel-perfect padding using fully dynamic cell sizing
  • Identifiable and RawRepresentable support in place of String SF Symbol name if you wanna be extra safe or you're using another library abstraction
  • Bring your own style or branding with SystemImagePickerStyle conformance
  • Support for SF Symbols 5 and visionOS

And much more!

Appearance

Light mode Dark mode
iOS default appearance with custom subset iOS default appearance with custom subset iOS default appearance with custom subset.
iOS unsectioned default appearance with confirmation required on dismiss and optional selection iOS unsectioned default appearance with confirmation required on dismiss and optional selection iOS unsectioned default appearance with confirmation required on dismiss and optional selection.
macOS default appearance with filled-only subset macOS default appearance with filled-only subset macOS default appearance with filled-only subset.
(The modal sheet was scaled up for visibility in the README alone)

Status

GitHub release (latest by date)

You can find all changelogs directly under every release.

Milestones, issues, are the best way to keep updated with active developement. Feel free to contribute by sending a pull request. Just remember to refer to our guidelines and Code of Conduct beforehand.