Swiftpack.co - tyagishi/SDSCustomView as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by tyagishi.
tyagishi/SDSCustomView 2.0.0
convenient view collection for SwiftUI
⭐️ 0
🕓 2 weeks ago
iOS macOS
.package(url: "https://github.com/tyagishi/SDSCustomView.git", from: "2.0.0")

SDSCustomView

convenience view collection

FixedWidthLabel

Sometimes we want to have fixed-width label"s" those have same width. Usually we don't mind width value itself, but want to align leading/center/traiing in same width.

looks like following.

FixedWidthLabel

You can easily achieve above layout with

VStack {
  FixedWidthLabel("123",widthFor: "0000").alignment(.trailing)
  FixedWidthLabel(  "1",widthFor: "0000").alignment(.trailing)
}

basically above is equivalent with following.

VStack {
    Text("0000")
      .hidden()
      .overlay(
         Text("123")
         .frame(maxWidth: .infinity, alignment: .trainling)
      )
    Text("0000")
      .hidden()
      .overlay(
         Text("1")
         .frame(maxWidth: .infinity, alignment: .trainling)
      )
}

Just for reducing boilerplates.

Note: it is NOT ultimately fixed width label. in case user modify their text size setting, label width would be affected.

GitHub

link
Stars: 0
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

2.0.0
2 weeks ago

used in App-Store app.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics