Swiftpack.co -  PhilippHuebl/SwiftUI-ColorPicker as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
PhilippHuebl/SwiftUI-ColorPicker
A customizable Color Picker 100% in SwiftUI
.package(url: "https://github.com/PhilippHuebl/SwiftUI-ColorPicker.git", from: "release")

SwiftUIColorPicker

A customizable Color Picker 100% in SwiftUI

Requirements

  • iOS 13.0+
  • Xcode 11+

Installation

To install SwiftUIColorPicker you can use the Swift Packet Manager (SPM).

In Xcode navigate to File → Swift Packages → Add Package Dependency...

Use this URL to add the dependency: https://github.com/PhilippHuebl/SwiftUI-ColorPicker

Styles

Circle

import SwiftUI
import SwiftUIColorPicker

struct ContentView: View {
    
    @State var foregroundColor : Color = Color(.blue)
    let colors : [Color] = [Color(.red), Color(.blue), Color(.green), Color(.orange), Color(.systemPink), Color(.systemTeal)]
    let borderColor : Color = Color(.black)
    
    
    var body: some View {
        VStack {
            Rectangle()
                .frame(width: 200, height: 100, alignment: .center)
                .foregroundColor(foregroundColor)
            
            CircleColorPicker(selectedColor: $foregroundColor, colors: colors, borderColor: borderColor, width: 50, height: 50, rows: 3, columns: 2)
                .frame(width: 200, height: 200, alignment: .center)
        }
        
    }
}

Rectangle

import SwiftUI
import SwiftUIColorPicker

struct ContentView: View {
    
    @State var foregroundColor : Color = Color(.blue)
    let colors : [Color] = [Color(.red), Color(.blue), Color(.green), Color(.orange), Color(.systemPink), Color(.systemTeal)]
    let borderColor : Color = Color(.black)
    
    
    var body: some View {
        VStack {
            Circle()
                .frame(width: 200, height: 100, alignment: .center)
                .foregroundColor(foregroundColor)
            
            RectangleColorPicker(selectedColor: $foregroundColor, colors: colors, borderColor: borderColor, width: 75, height: 50, rows: 2, columns: 3)
                .frame(width: 300, height: 200, alignment: .center)
        }
        
    }
}

Contributions

Contributions are welcome and encouraged!

License

SwiftUIColorPicker is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 1
Last commit: 2 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.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

Version 1.0.0
2 weeks ago

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