Skip to content

Instantly share code, notes, and snippets.

@cjnevin
Created October 23, 2022 00:36
Show Gist options
  • Save cjnevin/519997c1c2b3fea10afceadc3134c181 to your computer and use it in GitHub Desktop.
Save cjnevin/519997c1c2b3fea10afceadc3134c181 to your computer and use it in GitHub Desktop.
public protocol Constrainable {
var constraints: [NSLayoutConstraint] { get }
}
extension NSLayoutConstraint: Constrainable {
public var constraints: [NSLayoutConstraint] { [self] }
}
extension Array: Constrainable where Element == NSLayoutConstraint {
public var constraints: [NSLayoutConstraint] { self }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment