Set color slider in table view cell to full length of cell
<p>I am incorporating this <a href="https://github.com/gizmosachin/ColorSlider" rel="nofollow noreferrer">color slider</a> into my app and I am having trouble getting it to fit inside a table view cell so that it takes up the length of the cell in both portrait and landscape view. Below are two screenshots showing my app in portrait and landscape. You can see the color slider does not extend the full length of the cell. Here is my code that sets up the color slider. I am trying to figure out how to property code the CGRect so that the color slider dynamically fills the length of the cell.</p>

<pre><code>  func configureColorSlider() {
    let colorSlider = ColorSlider()
    let xCell = colorCell.contentView.bounds.width
    let yCell = colorCell.contentView.bounds.height
    colorSlider.frame = CGRect(x: xCell / 4, y: yCell / 4, width: 200, height: 24)
    colorSlider.orientation = .horizontal
    colorSlider.addTarget(self, action: #selector(ConfigureTimestampTableViewController.changedColor(_:)), for: .valueChanged)
    colorCell.contentView.addSubview(colorSlider)
  }
</code></pre>

<p>Current view in portrait:
<a href="https://i.stack.imgur.com/tqRzZ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tqRzZ.jpg" alt="Color Slider Portrait"></a></p>

<p>Current view in landscape:
<a href="https://i.stack.imgur.com/D01Sx.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D01Sx.jpg" alt="Color Slide Landscape"></a></p>

<p><strong><em>EDIT (Again)</em></strong> 
From your suggestion I updated my code below. This works great in portrait orientation. The color slider takes up the full size of the cell to the right of the color label. However, when I rotate the phone to landscape orientation the color slider only fills half the screen. Below is a screenshot of how it looks.</p>

<pre><code>  func configureColorSlider() {
    let colorSlider = ColorSlider()
    let xCell = colorCell.contentView.bounds.width
    let yCell = colorCell.contentView.bounds.height
    colorSlider.frame = CGRect(x: xCell / 4, y: yCell / 4, width: 200, height: 24)
    colorSlider.orientation = .horizontal
    colorSlider.addTarget(self, action: #selector(ConfigureTimestampTableViewController.changedColor(_:)), for: .valueChanged)

    colorCell.contentView.addSubview(colorSlider)

    colorSlider.translatesAutoresizingMaskIntoConstraints = false
    NSLayoutConstraint.activate([colorSlider.leadingAnchor.constraint(equalTo: colorLabel.trailingAnchor, constant: 8),
                                 colorSlider.trailingAnchor.constraint(equalTo: colorCell.contentView.trailingAnchor, constant: -8),
                                 colorSlider.topAnchor.constraint(equalTo: colorCell.contentView.topAnchor, constant: 8),
                                 colorSlider.bottomAnchor.constraint(equalTo: colorCell.contentView.bottomAnchor, constant: -8) ])


}
</code></pre>

<p><a href="https://i.stack.imgur.com/WJBc3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WJBc3.jpg" alt="Landscape Updated Code"></a></p>