Skip to content

Latest commit

 

History

History
71 lines (55 loc) · 1.5 KB

README.md

File metadata and controls

71 lines (55 loc) · 1.5 KB

… LeaderView

Platform

LeaderView is a configurable typographical element that renders a baseline "leader line" from one view to the next, as found in a book index:

Chapter One: The Dottening ……………………………… 1
Chapter Two: The Dots Return ………………………… 12
Chapter Three: These Things Again?! ……… 18
...
Chapter Twenty-Six: Where
the Hell Are They All
Coming From?!             ………………………………… 206

Features

You can configure:

  • Inter-view spacing
  • Inter-dot spacing
  • Dot diameter
  • Dot color
  • Layout Priority (leading / trailing views)
  • Vertical alignment (default/best is last-baseline)

Example

To create a simple leader:

import LeaderView

Leader {
  Text("Chapter One: The Dottening")
    .font(.title2)
} trailingView: {
  Text("1")
    .font(.title3)
    .monospaced()
    }

To get all fancy with it:

import LeaderView

Leader(
  dotDiameter: dotDiameter,
  viewSpacing: viewSpacing,
  dotSpacing: dotSpacing,
  minLeaderWidth: minLeaderWidth
) {
  Text("Introduction")
    .font(.title2)
} trailingView: {
  Text("ii")
    .font(.title3)
    .monospaced()
    .italic()
}

Contributing

Contributions are welcome! If you'd like to contribute to LeaderView, please fork the repository and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.