field_ios

In-the-field app for Radroots on iOS
git clone https://radroots.dev/git/field_ios.git
Log | Files | Refs | LICENSE

CopyRow.swift (712B)


      1 import SwiftUI
      2 
      3 public struct CopyRow: View {
      4     private let title: String
      5     private let value: String
      6     private let onCopied: (() -> Void)?
      7 
      8     public init(title: String, value: String, onCopied: (() -> Void)? = nil) {
      9         self.title = title
     10         self.value = value
     11         self.onCopied = onCopied
     12     }
     13 
     14     public var body: some View {
     15         LabeledContent(title) {
     16             HStack(spacing: 6) {
     17                 Text(value)
     18                     .font(.callout.monospaced())
     19                     .lineLimit(1)
     20                     .truncationMode(.middle)
     21                     .textSelection(.enabled)
     22                 CopyButton(value: value, onCopied: onCopied)
     23             }
     24         }
     25     }
     26 }