diff --git a/Mail/Components/IKLabelView.swift b/Mail/Utils/Label+Extension.swift similarity index 65% rename from Mail/Components/IKLabelView.swift rename to Mail/Utils/Label+Extension.swift index e7cdcf1ff..2f0b78119 100644 --- a/Mail/Components/IKLabelView.swift +++ b/Mail/Utils/Label+Extension.swift @@ -16,27 +16,14 @@ along with this program. If not, see . */ -import MailResources import SwiftUI -struct IKLabelView: View { - private let title: String - private let image: Image - - init(_ title: String, image: Image) { - self.title = title - self.image = image - } - - var body: some View { - Label { +extension Label where Title == Text, Icon == Image { + init(_ title: String, asset: Image) { + self.init { Text(title) } icon: { - image + asset } } } - -#Preview { - IKLabelView(MailResourcesStrings.Localizable.calendarNotInvited, image: MailResourcesAsset.socialMedia.swiftUIImage) -} diff --git a/Mail/Views/AI Writer/Proposition/AIPropositionMenu.swift b/Mail/Views/AI Writer/Proposition/AIPropositionMenu.swift index a0be4a052..e77e7c7ba 100644 --- a/Mail/Views/AI Writer/Proposition/AIPropositionMenu.swift +++ b/Mail/Views/AI Writer/Proposition/AIPropositionMenu.swift @@ -52,7 +52,7 @@ struct AIPropositionMenu: View { await aiModel.executeShortcut(action) } } label: { - IKLabelView(action.label, image: action.icon.swiftUIImage) + Label(action.label, asset: action.icon.swiftUIImage) } .disabled(aiModel.error != nil && action != .regenerate) } diff --git a/Mail/Views/New Message/ComposeMessageView.swift b/Mail/Views/New Message/ComposeMessageView.swift index 3baa36ce4..3b21ac13d 100644 --- a/Mail/Views/New Message/ComposeMessageView.swift +++ b/Mail/Views/New Message/ComposeMessageView.swift @@ -175,7 +175,7 @@ struct ComposeMessageView: View { .toolbar { ToolbarItem(placement: .navigationBarTrailing) { Button(action: didTouchSend) { - IKLabelView(MailResourcesStrings.Localizable.send, image: MailResourcesAsset.send.swiftUIImage) + Label(MailResourcesStrings.Localizable.send, asset: MailResourcesAsset.send.swiftUIImage) } .disabled(isSendButtonDisabled) } diff --git a/Mail/Views/Thread/Message/Calendar/CalendarBodyDetailsView.swift b/Mail/Views/Thread/Message/Calendar/CalendarBodyDetailsView.swift index dc1c35b3e..8fd420556 100644 --- a/Mail/Views/Thread/Message/Calendar/CalendarBodyDetailsView.swift +++ b/Mail/Views/Thread/Message/Calendar/CalendarBodyDetailsView.swift @@ -68,15 +68,12 @@ struct CalendarBodyDetailsView: View { } Group { - IKLabelView(event.formattedDateTime, image: MailResourcesAsset.calendarBadgeClock.swiftUIImage) + Label(event.formattedDateTime, asset: MailResourcesAsset.calendarBadgeClock.swiftUIImage) if let location = event.location, !location.isEmpty { - IKLabelView(location, image: MailResourcesAsset.pin.swiftUIImage) + Label(location, asset: MailResourcesAsset.pin.swiftUIImage) } if !iAmInvited && !event.attendees.isEmpty { - IKLabelView( - MailResourcesStrings.Localizable.calendarNotInvited, - image: MailResourcesAsset.socialMedia.swiftUIImage - ) + Label(MailResourcesStrings.Localizable.calendarNotInvited, asset: MailResourcesAsset.socialMedia.swiftUIImage) } } .labelStyle(.calendar())