-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for system spacing in iOS 11 and High Sierra #44
Comments
Also, if you're using baseline to baseline vertical constraints (i.e. Line spacing), the system spacing will take font size into account. |
Did the system spacing change between the three examples of “Lunch with Josh”? Or are they of different sizes for another reason.
|
If you use the system spacing on a vertical constraint from baseline to baseline of two labels, that spacing will dynamically adjust based on Dynamic Type size. |
Here's a little more info. The extension NSLayoutYAxisAnchor {
/* Constraints of the form,
receiver [= | ≥ | ≤] 'anchor' + 'multiplier' * system space,
where the value of the system space is determined from information available from the anchors.
The constraint affects how far the receiver will be positioned below 'anchor'.
If either the receiver or 'anchor' is the firstBaselineAnchor or lastBaselineAnchor of a view with text content
then the spacing will depend on the fonts involved and will change when those do.
*/
@available(iOS 11.0, *)
open func constraintEqualToSystemSpacingBelow(_ anchor: NSLayoutYAxisAnchor, multiplier: CGFloat) -> NSLayoutConstraint
@available(iOS 11.0, *)
open func constraintGreaterThanOrEqualToSystemSpacingBelow(_ anchor: NSLayoutYAxisAnchor, multiplier: CGFloat) -> NSLayoutConstraint
@available(iOS 11.0, *)
open func constraintLessThanOrEqualToSystemSpacingBelow(_ anchor: NSLayoutYAxisAnchor, multiplier: CGFloat) -> NSLayoutConstraint
} I believe the doc comment has swapped the Also, note that this is possible only on the Y axis, since it's apparently only used with text line spacing. Can our expression system encode that limitation? |
Oops, I think I was wrong about y-axis-only. According to these generated diffs, there are x and y variants of the system spacing methods:
|
Interesting that this is the first time a multiplier is supported for a spacing constraint. Do we know if a multiplier version of all spacing constraints will be available in iOS 11, or just this one? |
From the iOS 11 release notes:
Anchorage should add some kind of syntactic sugar or named
CGFloat
value like.system
or something. The new API looks like this:It might be nice to use it like this:
The text was updated successfully, but these errors were encountered: