2 Commits

Author SHA1 Message Date
Ryan Ackermann eecf56fc1a fixed an issue with the sample project 2020-04-29 10:49:26 -07:00
Ryan Ackermann 4871df3042 updated the readme
added an example for updating with a color
2020-04-29 10:48:11 -07:00
3 changed files with 89 additions and 2 deletions
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1140"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6908F4221B500AE500A410E2"
BuildableName = "ColorPickerExample.app"
BlueprintName = "ColorPickerExample"
ReferencedContainer = "container:ColorPickerExample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6908F4221B500AE500A410E2"
BuildableName = "ColorPickerExample.app"
BlueprintName = "ColorPickerExample"
ReferencedContainer = "container:ColorPickerExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6908F4221B500AE500A410E2"
BuildableName = "ColorPickerExample.app"
BlueprintName = "ColorPickerExample"
ReferencedContainer = "container:ColorPickerExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
+1 -1
View File
@@ -35,7 +35,7 @@ class ViewController: UIViewController, RAScrollablePickerViewDelegate {
}
func valueChanged(_ value: CGFloat, type: PickerType) {
switch(type) {
switch type {
case .hue:
colorPreView.backgroundColor = UIColor(hue: value, saturation: saturationPicker.value, brightness: brightnessPicker.value, alpha: 1)
saturationPicker.hueValueForPreview = value
+10 -1
View File
@@ -53,7 +53,7 @@ Finally make sure the parent view/viewcontroller conforms to RAScrollablePickerV
``` swift
func valueChanged(_ value: CGFloat, type: PickerType) {
switch(type) {
switch type {
case .hue:
colorPreView.backgroundColor = UIColor(hue: value, saturation: saturationPicker.value, brightness: brightnessPicker.value, alpha: 1)
saturationPicker.hueValueForPreview = value
@@ -66,6 +66,15 @@ func valueChanged(_ value: CGFloat, type: PickerType) {
}
```
### Update a picker with a color
```swift
let colors: [UIColor] = [.systemBlue, .systemOrange, .systemYellow]
let startColor = colors.randomElement() ?? .systemPink
picker.set(color: startColor)
```
## Contact
Feel free the reach out to me if you have an questions.