For those struggling with this; the ONLY think I could do to get this to work was add this line of code:
tempButton.translatesAutoresizingMaskIntoConstraints = false
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: