diff --git a/Packages/ComposeUI/Sources/ComposeUI/Controllers/ToolbarController.swift b/Packages/ComposeUI/Sources/ComposeUI/Controllers/ToolbarController.swift index 71976520..bcef0cf0 100644 --- a/Packages/ComposeUI/Sources/ComposeUI/Controllers/ToolbarController.swift +++ b/Packages/ComposeUI/Sources/ComposeUI/Controllers/ToolbarController.swift @@ -181,13 +181,8 @@ class ToolbarController: ViewController { private var formatButtons: some View { ForEach(StatusFormat.allCases, id: \.rawValue) { format in Button(action: controller.formatAction(format)) { - if let imageName = format.imageName { - Image(systemName: imageName) - .font(.system(size: imageSize)) - } else if let (str, attrs) = format.title { - let container = try! AttributeContainer(attrs, including: \.uiKit) - Text(AttributedString(str, attributes: container)) - } + Image(systemName: format.imageName) + .font(.system(size: imageSize)) } .accessibilityLabel(format.accessibilityLabel) .padding(5) diff --git a/Packages/ComposeUI/Sources/ComposeUI/Model/StatusFormat.swift b/Packages/ComposeUI/Sources/ComposeUI/Model/StatusFormat.swift index 2357b019..af57c88d 100644 --- a/Packages/ComposeUI/Sources/ComposeUI/Model/StatusFormat.swift +++ b/Packages/ComposeUI/Sources/ComposeUI/Model/StatusFormat.swift @@ -23,7 +23,7 @@ enum StatusFormat: Int, CaseIterable { } } - var imageName: String? { + var imageName: String { switch self { case .italics: return "italic" @@ -31,16 +31,8 @@ enum StatusFormat: Int, CaseIterable { return "bold" case .strikethrough: return "strikethrough" - default: - return nil - } - } - - var title: (String, [NSAttributedString.Key: Any])? { - if self == .code { - return ("", [.font: UIFont(name: "Menlo", size: 17)!]) - } else { - return nil + case .code: + return "chevron.left.forwardslash.chevron.right" } } diff --git a/Packages/ComposeUI/Sources/ComposeUI/Views/MainTextView.swift b/Packages/ComposeUI/Sources/ComposeUI/Views/MainTextView.swift index 23fe44e3..0d6c5265 100644 --- a/Packages/ComposeUI/Sources/ComposeUI/Views/MainTextView.swift +++ b/Packages/ComposeUI/Sources/ComposeUI/Views/MainTextView.swift @@ -259,11 +259,7 @@ fileprivate struct MainWrappedTextViewRepresentable: UIViewRepresentable { if range.length > 0 { let formatMenu = suggestedActions[index] as! UIMenu let newFormatMenu = formatMenu.replacingChildren(StatusFormat.allCases.map { fmt in - var image: UIImage? - if let imageName = fmt.imageName { - image = UIImage(systemName: imageName) - } - return UIAction(title: fmt.accessibilityLabel, image: image) { [weak self] _ in + return UIAction(title: fmt.accessibilityLabel, image: UIImage(systemName: fmt.imageName)) { [weak self] _ in self?.applyFormat(fmt) } })