Swiftpack.co -  franklynw/PresentableColorPicker as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
SwiftUI ColorPicker which can be presented programmatically (rather than via a ColorPicker button)
.package(url: "https://github.com/franklynw/PresentableColorPicker.git", from: "1.0.5")


A Colour Picker pretty much identical to Apple's ColorPicker (in that it uses the UIColorPickerViewController), except that this one can be presented in the way common to sheets, etc, with a bound 'isPresented' boolean var.


Swift Package Manager

In Xcode:


NB: All examples require import PresentableColorPicker at the top of the source file

It can be used directly as a view, which offers the full range of customisation options -

var body: some View {
    PresentableColorPicker(isPresented: $isStandaloneColorPickerPresented) {
        viewModel.paintColor = $0

or as a modifier, which presents the default colour picker (with no customisation options) -

var body: some View {

    MyView {
    .presentableColorPicker(isPresented: $isStandaloneColorPickerPresented, Binding: $viewModel.paintColor)

Both of these methods allow you to specify either a binding to a Color var, or use a 'colorSelected' closure which is invoked when the colour is picked.

Set the picker's title

PresentableColorPicker(isPresented: $isStandaloneColorPickerPresented, selected: $viewModel.paintColor)
    .title("Pick a colour")

If not used, the title will default to localised "Colour" (ie, if you have "Colour" in your Localizable.strings file, it will use that, otherwise just "Colour")

Disable the automatic "dismiss on selection" functionality

This might be necessary if you have (eg) a preview visible above the picker, where you can see how your selected colour looks - the user can then decide when to dismiss the picker

PresentableColorPicker(isPresented: $isStandaloneColorPickerPresented, selected: $viewModel.paintColor)

Set the picker's background colour

PresentableColorPicker(isPresented: $isStandaloneColorPickerPresented, selected: $viewModel.paintColor)

Set the height of the picker as either a fixed height or as a proportion of the containing view's height

PresentableColorPicker(isPresented: $isStandaloneColorPickerPresented, selected: $viewModel.paintColor)


PresentableColorPicker(isPresented: $isStandaloneColorPickerPresented, selected: $viewModel.paintColor)


There are two NotificationCenter notifications which are sent, which are defined as static vars on Notification.Name -

  • presentableColorPickerAppeared ("PresentableColorPickerAppearedNotification")
  • presentableColorPickerDisappeared ("PresentableColorPickerDisappearedNotification")

These are sent as their names suggest, and there is no additional userInfo


Requires HalfASheet, which is linked. Take a look at it here


PresentableColorPicker is available under the MIT licence


Stars: 1
Last commit: 4 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.


Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API