Skip to content

A commonly used view for SwiftUI's List and Form

Notifications You must be signed in to change notification settings

bdaralan/ValueRow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ValueRow

A commonly used view for SwiftUI's List and Form. The view contains an image, a leading label, and a trailing value.

Highlight Features

  • Supports multiline text: Label and Value.
  • Supports individual font: Image, Label, and Value.
  • Supports tap or long press action: Image, Label, and Value.

Sample Code

import ValueRow

struct CheckoutView: View {
    
    var body: some View {
        Form {
            Section("ITEM") {
                ValueRow("Name", value: "Ice Cream")
                    .withContent(alignment: .firstTextBaseline)
                    .withValue(lineLimit: 2)
                
                ValueRow("Price", value: "$4.00")
                    .withValue(font: .body.monospacedDigit())
                
                ValueRow("Quantity", value: "3")
                    .withValue(font: .body.monospacedDigit())
            }
            Section("TOTAL") {
                ValueRow("Subtotal", symbol: "plus.circle", value: "$12.00")
                    .withValue(font: .body.monospacedDigit())
                
                ValueRow("Discount", symbol: "minus.circle", value: "$3.00")
                    .withValue(font: .body.monospacedDigit())
                
                ValueRow("Total", symbol: "equal.circle", value: "$9.00")
                    .withLabel(font: .title3.weight(.bold))
                    .withValue(font: .title3.monospacedDigit().weight(.bold))
            }
        }
    }
}

About

A commonly used view for SwiftUI's List and Form

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages