Open ydnar opened 4 years ago
@ydnar Please excuse the late reply. Could you show the code you write at the moment and how you would ideally write it ?
Thanks!
We use Stevia to lay out views with respect to the layout guides and safe area. We often want to express a bottom constraint as <=
. For instance, from some code we’re currently using:
textView.Bottom <= Bottom - 12
(textView.Bottom == layoutMarginsGuide.Bottom + 10).priority = .defaultHigh
Ideally we could express this as:
textView.Bottom <= Bottom - 12
textView.Bottom <= layoutMarginsGuide.Bottom + 10
I tried to implement ourselves, e.g.:
@available(iOS 9.0, *)
@discardableResult
public func <= (left: SteviaAttribute, right: SteviaLayoutYAxisAnchor) -> NSLayoutConstraint {
…
…but couldn’t because SteviaAttribute.attribute
is internal
, which prevents anyone from extending this. Could you make these attributes public?
Related: thanks for adding the operators in #155!
Would it be possible to add support for additional operators other than
==
to layout anchors (SteviaLayoutXAxisAnchor
,SteviaLayoutYAxisAnchor
), such as<
<=
>
>=
?We work around this now by using multiple constraints with differing priorities.