From 2bebe1e16785e2e5ba10040e728dd1761b22d121 Mon Sep 17 00:00:00 2001 From: oliverhnat Date: Sun, 25 Feb 2024 11:42:45 +0100 Subject: [PATCH] Make the text selectable (for copying and lookup), after description is shown --- WordAX/WordView.swift | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/WordAX/WordView.swift b/WordAX/WordView.swift index 9c4f5db..de7dbf4 100644 --- a/WordAX/WordView.swift +++ b/WordAX/WordView.swift @@ -14,20 +14,26 @@ struct WordView: View { @EnvironmentObject var model: WordAXModelView @Environment(\.colorScheme) var colorScheme + var body: some View { + let wordText = Text(word.name) + .font(.title) + .bold() + VStack { - Text(word.name) - .font(.title) - .bold() if word.shown && word.lastSeenOn != nil { Text(model.getDateFormatter().string(from: word.lastSeenOn!)) } if showDescription { + wordText + .textSelection(.enabled) Divider() .background(colorScheme == .light ? Color.black : Color.white) .padding(.horizontal) Text(word.description) .multilineTextAlignment(.center) + } else { + wordText } } .padding([.horizontal, .top])