Want More From ColorPicker in iOS 14? Create 1500+ SwiftUI Pickers of Your Own

Want More From ColorPicker in iOS 14? Create 1500+ SwiftUI Pickers of Your Own

Make custom colour pickers and reuse them in any project with Swift Package Manager

The iOS 14 ColorPicker

iOS 14 brings updates to the SwiftUI API, and that means we get some new Views to use in our apps. It might be a surprise to learn that we now have a ColorPicker, which we can use simply by passing a Binding for a colour that we want to pick. This makes it much easier than ever before to choose a custom colour in our iOS, iPadOS and MacOS apps, but what about when we want custom controls? The ColorPicker as it is seems to have a fairly rigid set of controls that can’t be changed by the developer.

What if we want different controls?

What if we want the controls to look how we want them to look?

If we make our own, we can do whatever we want!


1,500+ Colour Pickers

I should probably explain how I got to that 1,500+ number in the headline.

This will show I’m not exaggerating while showing everything you’ll learn, so it serves multiple purposes.

We are using four colour spaces for these colour pickers:

  • Cyan, magenta, yellow, black, alpha (CMYKA)
  • Hue, saturation, brightness, alpha (HSBA)
  • Red, green, blue, alpha (RGBA)
  • White, alpha (greyscale)

Every picker you’ll make in this tutorial occupies a single colour space and allows you to set every parameter without having several controls for the same parameter.

Below are the controls you’ll make:

Canvases

Canvases use the x and y coordinates to pick two parameters at once (hue/saturation in this case)

You’ll learn to create canvases, which allow you to pick a point on a square. If the _x-_axis is brightness and the _y-_axis is saturation, the coordinates of the point you pick will set both of these parameters.

programming swiftui swift mobile ios

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

SwiftUI Grids in iOS 14

SwiftUI was announced at WWDC 2019 and it paved a way for declarative programming for building interfaces. SwiftUI Grid comes in two different flavours, which includes LazyVGrid and LazyHGrid. As the name suggest, LazyVGrid is a Grid that flows in vertical direction and the LazyHGrid flows in horizontal direction

How to Build a Timer using Swift and SwiftUI

A great place to start building with SwiftUI

Understanding Grids in SwiftUI for iOS 14

SwiftUI was announced at WWDC 2019 and it paved a way for declarative programming for building interfaces. SwiftUI Grid comes in two different flavours, which includes LazyVGrid and LazyHGrid. As the name suggest, LazyVGrid is a Grid that flows in vertical direction and the LazyHGrid flows in horizontal direction.

SwiftUI’s GroupBox, OutlineGroup, and DisclosureGroup in iOS 14

SwiftUI was inevitably going to see big changes this year, and I'm really excited to experiment with them all – text views, color pickers, progress

Top Swift iOS App Development Company in USA

AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!