How to change to before and after constraints using uicolorview as a button (swift code)?

The code listed below has a button that when is pressed makes the large blue box turn into a small blue box. How can the code be written so that I can just click on the blue box for it turn into the smaller box? The blue boxes are not images they are simply are coded using uicolorview. Thanks

     class ViewController: UIViewController {

    let colorview = UIView()
    var allc = [NSLayoutConstraint]()
   override func viewDidLoad() {
    colorview.translatesAutoresizingMaskIntoConstraints = false
    colorview.backgroundColor = UIColor.blueColor()

    let leadingc = colorview.leadingAnchor.constraintEqualToAnchor(self.view.leadingAnchor)
    let trailingC = colorview.trailingAnchor.constraintEqualToAnchor(self.view.trailingAnchor)
    let topc = colorview.topAnchor.constraintEqualToAnchor(self.view.topAnchor)
    let bottomc = colorview.bottomAnchor.constraintEqualToAnchor(self.view.bottomAnchor, constant: -50)

    NSLayoutConstraint.activateConstraints([leadingc, trailingC, topc, bottomc])

    let widthc = colorview.widthAnchor.constraintEqualToConstant(100)
    let heightc = colorview.heightAnchor.constraintEqualToConstant(100)
    let centerxc = colorview.centerXAnchor.constraintEqualToAnchor(self.view.centerXAnchor)
    let centeryc = colorview.centerYAnchor.constraintEqualToAnchor(self.view.centerYAnchor)

    allc = [leadingc, trailingC, topc, bottomc, widthc, heightc, centerxc, centeryc]

@IBAction func changethebleep(sender: AnyObject) {

    var newactive = [NSLayoutConstraint]()

    for constraint in allc {
        if {
   = false
        } else {



You would need to attach a UIGesture to the blue-box-view which you called colorView. Something like:

import UIKit
class ViewController: UIViewController {

    @IBOutlet weak var myView: UIView!

    override func viewDidLoad() {

        // Add tap gesture recognizer to view
        let tapGesture = UITapGestureRecognizer(target: self, action: Selector("handleTap:"))

    // this method is called when a tap is recognized
    func handleTap(sender: UITapGestureRecognizer) {