How do I increase the distance between the lines in Xcode? I mean in the actual code.
Even when I change the font and font sizes in the Xcode preferences, the code lines are still too close together and it is very annoying.
Use lineSpacing(_:) to set the amount of spacing from the bottom of one line to the top of the next for text elements in the view. In the Text view in the example below, 10 points separate the bottom of one line to the top of the next as the text field wraps inside this view.
SwiftUI text does not provide a lineHeight property (line spacing is a different beast). You could try to align the 'firstTextBaseLine' to get the desired behaviour. Alternatively, use a 'UILabel' (via 'UIViewRepresentable') with an attributed string (specify line height in the paragraph style).
Step #2: Place a UILabel into a Storyboard/XIB and set its class to DesignableLabel . Wait for your project to build (build must succeed!). Step 3: Now you should see a new property in the properties pane named "Line Height". Just set the value you like and you should see the results immediately!
The line-height CSS property sets the height of a line box. It's commonly used to set the distance between lines of text. On block-level elements, it specifies the minimum height of line boxes within the element. On non-replaced inline elements, it specifies the height that is used to calculate line box height.
Also check out the Meslo font; an open source customized version of Menlo that comes with much nicer line-spacing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With