gizmosachin / ColorSlider

🎨 Snapchat-style color picker in Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'ColorSlider' initializer is inaccessible due to 'internal' protection level

halinebr opened this issue · comments

Hi there! Wanted to let you know that when I try to initialize a color slider object, the only init method made available is
ColorSlider(orientation: <#T##Orientation#>, previewView: <#T##PreviewView?#>)
Also, the DefaultPreviewView() is not accessible as well.
I am using pod version 4.0.
Thanks!

Hi @halinebr! That initializer being the only one available is intentional. You can pass an orientation and not pass a preview view param (or pass nil) if you want to use the default preview view.

The part of the README that mentions DefaultPreviewView assumes you're using Cocoapods. If you aren't, you should be able to instantiate it with just let previewView = DefaultPreviewView(). Let me know if this helps.

Ah, okay. I have it working now, thank you! You might want to update your documentation then as the first usage example for adding a ColorSlider to your view because it is a little misleading. The initializer with previewSide as a parameter is no longer accessible.

Oh, great catch! I'll fix that. If you want to control the default preview side:

let previewView = DefaultPreviewView(side: .left)
let colorSlider = ColorSlider(orientation: .vertical, previewView: previewView)

Ah, that initializer is still available it just isn't public. Will update the source and push a new release to Cocoapods. Thanks!

'orientation' is inaccessible due to 'internal' protection level

i tried to initialise in view did showing the same errors repeatedly i tried above mentioned solutions also

@sivaprasad3175 Can you please post a code snippet? If you tried to access orientation outside of the ColorSlider initializer then that error message is correct.