Skip to content

Commit

Permalink
Refactor FXIOS-10205 [Swiftlint] Resolve 1 implicitly_unwrapped_optio…
Browse files Browse the repository at this point in the history
…nal violations in BackForwardTableViewCell (#23813)

* Resolve warnings in BackForwardTableViewCell

* Use modern Swift conditional unwrapping syntax

---------

Co-authored-by: Marceau Tonelli <[email protected]>
  • Loading branch information
tonell-m and tonelli-m authored Dec 17, 2024
1 parent 24fdd76 commit 2c30856
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 2c30856

Please sign in to comment.