Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.

Releases: gizmosachin/ColorSlider

Support Swift 5.0

09 Apr 04:53
Compare
Choose a tag to compare

Fix internal initializer

04 Oct 17:21
Compare
Choose a tag to compare

4.0

26 Sep 06:06
Compare
Choose a tag to compare
4.0

ColorSlider 4.0 is a major new version that supports full customization of the preview view and selecting black and white colors from within the slider. The project has been fully rewritten to be more simple and customizable, with a much cleaner API surface and view hierarchy. The major new features include:

  • Full preview view customization via the ColorPreviewable protocol.
  • Customizable DefaultPreviewView that supports custom animation duration, scale, size, and offset.
  • Black and white colors are now accessible from within the slider (#15).
  • Settable color property that updates the current color on the slider (#19).
  • New demo project that no longer requires external dependencies or Cocoapods.
  • Swift 4

Breaking Changes

Live Preview

  • The color preview is now enabled by default. previewEnabled has been replaced by a previewView parameter in the initializer. Pass nil for this property to disable the preview.

  • Preview behavior has changed. A minimized version of the preview now shows on top of ColorSlider, even when touches are not being tracked, indicating the color currently selected (given by color).

  • previewDimension has been replaced and the default preview view now resizes based on the size of the slider. To manually set the preview size:

    colorSlider.autoresizesSubviews = false
    colorSlider.previewView.bounds = CGRect(origin: .zero, size: CGSize(44, 44))
  • previewOffset is now a property on the DefaultPreviewView and designates the offset from the center of the ColorSlider rather than the edge (as it did before):

    if let previewView = colorSlider.previewView as? DefaultPreviewView {
    	previewView.offsetAmount = 60
    }
  • To hide the minimized preview and mimic the behavior of the old preview view:

    if let previewView = colorSlider.previewView as? DefaultPreviewView {
    	previewView.scaleAmounts[.inactive] = 0.001
    }
  • There are several other properties on the DefaultPreviewView that can be customized. Alternatively, you can now subclass DefaultPreviewView or implement ColorPreviewable in a UIView subclass and pass it into the ColorSlider initializer to use a completely custom preview.

Appearance

  • borderWidth has been replaced by gradientView.layer.borderWidth.

  • borderColor has been replaced by gradientView.layer.borderColor and now requires a CGColor instead of a UIColor.

  • cornerRadius has been replaced by gradientView.layer.cornerRadius instead.

  • setsCornerRadiusAutomatically has been replaced by gradientView.automaticallyAdjustsCornerRadius

  • orientation is no longer settable after initialization. Pass the orientation in the initializer instead.

3.0.1

07 Sep 06:00
Compare
Choose a tag to compare
  • f482ff9: Keep drawLayer’s bounds synced with the view’s own layer
  • 8019e9d: Add a property to enable and disable rounded corners

3.0

07 Sep 06:06
Compare
Choose a tag to compare
3.0

fa7a40e: Support for Swift 3.0.

2.5

07 Sep 06:05
Compare
Choose a tag to compare
2.5

893a0c7: Fix horizontal orientation.

2.4

07 Sep 06:02
Compare
Choose a tag to compare
2.4

2.3

07 Sep 06:08
Compare
Choose a tag to compare
2.3

Clean up internal source, remove storyboards from sample project.

1.1

06 Feb 22:09
Compare
Choose a tag to compare
1.1
  • supports editing appearance properties within Interface Builder (see Main.storyboard in example project)
  • padding is now edgeInsets (and now works correctly)
  • ability to add shadow
  • cleaned up code and sample project

1.0

06 Feb 22:09
Compare
Choose a tag to compare
1.0

Supports changing color hue when dragging inside the bounds of the ColorSlider and modifying lightness when dragging outside its bounds.