Using NSLayoutConstraints in convenience init

Hi all,

I"m trying to create a convenience initializer that takes a NSLayoutConstraint array as parameters.

Something along the lines of the following:

convenience init(constraint: [NSLayoutConstraint]) {
    self.init()
}

This would then be implemented like the following when instantiating a new object.

let sampleClass = SampleClass([.topAnchor, .leadingAnchor])

I'm been trying to figure out how to implement this, however no luck so far. Any help would be much appreciated.

Terms of Service

Privacy Policy

Cookie Policy