I am trying to add a custom view programmatically to my view controller. I used this snippet of code with no success of it appearing in front of my main view controller.
var DynamicView = CustomFilter()
DynamicView.setTranslatesAutoresizingMaskIntoConstraints(false)
self.view.addSubview(DynamicView)
CustomFilter Class:
import UIKit
class CustomFilter:
UIView {
@IBOutlet weak var party: UIButton!
@IBOutlet weak var outdoors: UIButton!
@IBOutlet weak var sports: UIButton!
@IBOutlet weak var diner: UIButton!
@IBOutlet weak var music: UIButton!
@IBOutlet weak var gaming: UIButton!
}
The custom filter is connected to a xib file.
Xib File:

Is there a possibility that the custom view maybe out of placed? I'm not sure what I'm doing wrong.