Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| eecf56fc1a | |||
| 4871df3042 |
@@ -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>
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user