how to get UIButton color in swift
<p>i have UIButton with background colour, now i want that Button colour to be set in separate colour filed</p>

<p>i tried by this method :</p>

<p>initialising :</p>

<pre><code>var color1 = UIColor()
color1 = dateBtn1.backgroundColor!
</code></pre>

<p>setting :</p>

<pre><code>if color1 == UIColor.lightGrayColor() {
                dateBtn1.backgroundColor = UIColor.lightGrayColor()

            }else{
                dateBtn1.backgroundColor =  UIColor(red: 85/255, green: 175/255, blue: 101/255, alpha: 1.0)
            }
</code></pre>

<p>my crash Report :</p>

<pre><code>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -isEqual: not defined for the UIColor &lt;UIPlaceholderColor: 0x7f953241d150&gt;; need to first convert colorspace.'
</code></pre>