Skip to content

Commit 5c43035

Browse files
committed
v1.0 Initial public offering
0 parents  commit 5c43035

File tree

5 files changed

+405
-0
lines changed

5 files changed

+405
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
/.build
3+
/Packages
4+
xcuserdata/
5+
DerivedData/
6+
.swiftpm/configuration/registries.json
7+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
8+
.netrc

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Joshua Nozzi
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Package.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// swift-tools-version: 6.0
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "LeaderView",
8+
platforms: [
9+
.macOS(.v14),
10+
.iOS(.v17)
11+
],
12+
products: [
13+
// Products define the executables and libraries a package produces, making them visible to other packages.
14+
.library(
15+
name: "LeaderView",
16+
targets: ["LeaderView"])
17+
],
18+
targets: [
19+
// Targets are the basic building blocks of a package, defining a module or a test suite.
20+
// Targets can depend on other targets in this package and products from dependencies.
21+
.target(
22+
name: "LeaderView")
23+
24+
]
25+
)

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# … LeaderView
2+
3+
![Platform](https://img.shields.io/badge/platform-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS-blue)
4+
5+
`LeaderView` is a configurable typographical element that renders a baseline "leader line" from one view to the next, as found in a book index:
6+
7+
```
8+
Chapter One: The Dottening ……………………………… 1
9+
Chapter Two: The Dots Return ………………………… 12
10+
Chapter Three: These Things Again?! ……… 18
11+
...
12+
Chapter Twenty-Six: Where
13+
the Hell Are They All
14+
Coming From?! ………………………………… 206
15+
```
16+
17+
## Features
18+
19+
You can configure:
20+
21+
* Inter-view spacing
22+
* Inter-dot spacing
23+
* Dot diameter
24+
* Dot color
25+
* Layout Priority (leading / trailing views)
26+
* Vertical alignment (default/best is last-baseline)
27+
28+
29+
### Example
30+
31+
To create a simple leader:
32+
33+
```swift
34+
import LeaderView
35+
36+
Leader {
37+
Text("Chapter One: The Dottening")
38+
.font(.title2)
39+
} trailingView: {
40+
Text("1")
41+
.font(.title3)
42+
.monospaced()
43+
}
44+
```
45+
46+
To get all fancy with it:
47+
48+
```swift
49+
import LeaderView
50+
51+
Leader(
52+
dotDiameter: dotDiameter,
53+
viewSpacing: viewSpacing,
54+
dotSpacing: dotSpacing,
55+
minLeaderWidth: minLeaderWidth
56+
) {
57+
Text("Introduction")
58+
.font(.title2)
59+
} trailingView: {
60+
Text("ii")
61+
.font(.title3)
62+
.monospaced()
63+
.italic()
64+
}
65+
```
66+
67+
### Contributing
68+
Contributions are welcome! If you'd like to contribute to LeaderView, please fork the repository and submit a pull request.
69+
70+
### License
71+
This project is licensed under the MIT License - see the LICENSE file for details.

0 commit comments

Comments
 (0)