diff --git a/Note/FormatterView.swift b/Note/FormatterView.swift index 4bad4ad..9b398de 100644 --- a/Note/FormatterView.swift +++ b/Note/FormatterView.swift @@ -18,7 +18,9 @@ struct FormatterView: View { List { inputSection actionSection - resultSection + if !outputText.isEmpty { + resultSection + } } .listStyle(.insetGrouped) .navigationTitle("文案格式化") @@ -83,25 +85,18 @@ struct FormatterView: View { private var resultSection: some View { Section { - if outputText.isEmpty { - Text("点击上方按钮生成格式化结果") - .foregroundStyle(.secondary) - } else { - TextEditor(text: .constant(outputText)) - .frame(minHeight: 160) - .scrollContentBackground(.hidden) - .background(Color(.secondarySystemGroupedBackground)) - } + TextEditor(text: .constant(outputText)) + .frame(minHeight: 160) + .scrollContentBackground(.hidden) + .background(Color(.secondarySystemGroupedBackground)) } header: { HStack { Text("格式化结果") Spacer() - if !outputText.isEmpty { - Button(action: copyOutput) { - Image(systemName: "doc.on.doc") - } - .font(.subheadline) + Button(action: copyOutput) { + Image(systemName: "doc.on.doc") } + .font(.subheadline) } } }