Skip to content

A typographical leader line view for SwiftUI

License

Notifications You must be signed in to change notification settings

jnozzi/LeaderView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

… 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.

About

A typographical leader line view for SwiftUI

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages