how to center a view programmatically in swift code example
Example 1: how to set the center in view in swift
childView.center = parentView.center
Example 2: how to set the center in view in swift
childView.centerXAnchor.constraint(equalTo: parentView.centerXAnchor).isActive = true
childView.centerYAnchor.constraint(equalTo: parentView.centerYAnchor).isActive = true