-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5c43035
Showing
5 changed files
with
405 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.DS_Store | ||
/.build | ||
/Packages | ||
xcuserdata/ | ||
DerivedData/ | ||
.swiftpm/configuration/registries.json | ||
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata | ||
.netrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Joshua Nozzi | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// swift-tools-version: 6.0 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "LeaderView", | ||
platforms: [ | ||
.macOS(.v14), | ||
.iOS(.v17) | ||
], | ||
products: [ | ||
// Products define the executables and libraries a package produces, making them visible to other packages. | ||
.library( | ||
name: "LeaderView", | ||
targets: ["LeaderView"]) | ||
], | ||
targets: [ | ||
// Targets are the basic building blocks of a package, defining a module or a test suite. | ||
// Targets can depend on other targets in this package and products from dependencies. | ||
.target( | ||
name: "LeaderView") | ||
|
||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# … LeaderView | ||
|
||
![Platform](https://img.shields.io/badge/platform-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS-blue) | ||
|
||
`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: | ||
|
||
```swift | ||
import LeaderView | ||
|
||
Leader { | ||
Text("Chapter One: The Dottening") | ||
.font(.title2) | ||
} trailingView: { | ||
Text("1") | ||
.font(.title3) | ||
.monospaced() | ||
} | ||
``` | ||
|
||
To get all fancy with it: | ||
|
||
```swift | ||
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. |
Oops, something went wrong.