31 lines
959 B
Swift
31 lines
959 B
Swift
import SwiftUI
|
|
|
|
struct MnemonicGridView: View {
|
|
let mnemonic: String
|
|
|
|
private var words: [String] {
|
|
mnemonic.split(whereSeparator: { $0.isWhitespace }).map { String($0) }
|
|
}
|
|
|
|
var body: some View {
|
|
let cols = [GridItem(.flexible()), GridItem(.flexible())]
|
|
LazyVGrid(columns: cols, spacing: 8) {
|
|
ForEach(Array(words.enumerated()), id: \.offset) { idx, word in
|
|
HStack {
|
|
Text("\(idx + 1).")
|
|
.frame(width: 28, alignment: .trailing)
|
|
.foregroundStyle(.secondary)
|
|
.font(.footnote)
|
|
Text(word)
|
|
.font(.body.monospaced())
|
|
Spacer()
|
|
}
|
|
.padding(.vertical, 4)
|
|
.padding(.horizontal, 8)
|
|
.background(Color.gray.opacity(0.08))
|
|
.cornerRadius(6)
|
|
}
|
|
}
|
|
}
|
|
}
|