From 2c308562f545356be63a1cd63ea2e73ff4667762 Mon Sep 17 00:00:00 2001 From: Marceau TONELLI Date: Tue, 17 Dec 2024 18:33:12 +0100 Subject: [PATCH] Refactor FXIOS-10205 [Swiftlint] Resolve 1 implicitly_unwrapped_optional violations in BackForwardTableViewCell (#23813) * Resolve warnings in BackForwardTableViewCell * Use modern Swift conditional unwrapping syntax --------- Co-authored-by: Marceau Tonelli --- .../Client/Frontend/Browser/BackForwardTableViewCell.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/firefox-ios/Client/Frontend/Browser/BackForwardTableViewCell.swift b/firefox-ios/Client/Frontend/Browser/BackForwardTableViewCell.swift index 53f540b21fcd..d811a579b662 100644 --- a/firefox-ios/Client/Frontend/Browser/BackForwardTableViewCell.swift +++ b/firefox-ios/Client/Frontend/Browser/BackForwardTableViewCell.swift @@ -34,7 +34,7 @@ class BackForwardTableViewCell: UITableViewCell, ReusableCell, ThemeApplicable { lazy var label: UILabel = .build { _ in } - var viewModel: BackForwardCellViewModel! + var viewModel: BackForwardCellViewModel? override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) @@ -67,7 +67,7 @@ class BackForwardTableViewCell: UITableViewCell, ReusableCell, ThemeApplicable { override func draw(_ rect: CGRect) { super.draw(rect) - guard let context = UIGraphicsGetCurrentContext() else { return } + guard let context = UIGraphicsGetCurrentContext(), let viewModel else { return } var startPoint = CGPoint( x: rect.origin.x + UX.faviconPadding + UX.faviconWidth * 0.5 + safeAreaInsets.left, @@ -128,7 +128,7 @@ class BackForwardTableViewCell: UITableViewCell, ReusableCell, ThemeApplicable { func applyTheme(theme: Theme) { label.textColor = theme.colors.textPrimary - viewModel.strokeBackgroundColor = theme.colors.borderPrimary + viewModel?.strokeBackgroundColor = theme.colors.borderPrimary faviconView.layer.borderColor = theme.colors.borderPrimary.cgColor faviconView.tintColor = theme.colors.iconPrimary }