From 216a83771ecd8602196c47f162983c4d819492b8 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 20 Apr 2024 15:41:34 -0700 Subject: [PATCH] Fix some concurrency warnings. --- iOS/Feeds/Cell/FeedTableViewCellLayout.swift | 2 +- iOS/Timeline/Cell/MultilineUILabelSizer.swift | 2 +- iOS/Timeline/Cell/TimelineAccessibilityCellLayout.swift | 2 +- iOS/Timeline/Cell/TimelineCellLayout.swift | 6 +++--- iOS/Timeline/Cell/TimelineDefaultCellLayout.swift | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/iOS/Feeds/Cell/FeedTableViewCellLayout.swift b/iOS/Feeds/Cell/FeedTableViewCellLayout.swift index fb28690bd..bbc0794e0 100644 --- a/iOS/Feeds/Cell/FeedTableViewCellLayout.swift +++ b/iOS/Feeds/Cell/FeedTableViewCellLayout.swift @@ -31,7 +31,7 @@ struct FeedTableViewCellLayout { let height: CGFloat - init(cellWidth: CGFloat, insets: UIEdgeInsets, label: UILabel, unreadCountView: FeedUnreadCountView, showingEditingControl: Bool, indent: Bool, shouldShowDisclosure: Bool) { + @MainActor init(cellWidth: CGFloat, insets: UIEdgeInsets, label: UILabel, unreadCountView: FeedUnreadCountView, showingEditingControl: Bool, indent: Bool, shouldShowDisclosure: Bool) { var initialIndent = insets.left if indent { diff --git a/iOS/Timeline/Cell/MultilineUILabelSizer.swift b/iOS/Timeline/Cell/MultilineUILabelSizer.swift index c5859ba42..4764629ff 100644 --- a/iOS/Timeline/Cell/MultilineUILabelSizer.swift +++ b/iOS/Timeline/Cell/MultilineUILabelSizer.swift @@ -26,7 +26,7 @@ struct TextFieldSizeInfo { let numberOfLinesUsed: Int // A two-line text field may only use one line, for instance. This would equal 1, then. } -final class MultilineUILabelSizer { +@MainActor final class MultilineUILabelSizer { private let numberOfLines: Int private let font: UIFont diff --git a/iOS/Timeline/Cell/TimelineAccessibilityCellLayout.swift b/iOS/Timeline/Cell/TimelineAccessibilityCellLayout.swift index e63d54756..bf9ea28c5 100644 --- a/iOS/Timeline/Cell/TimelineAccessibilityCellLayout.swift +++ b/iOS/Timeline/Cell/TimelineAccessibilityCellLayout.swift @@ -19,7 +19,7 @@ struct TimelineAccessibilityCellLayout: TimelineCellLayout { let feedNameRect: CGRect let dateRect: CGRect - init(width: CGFloat, insets: UIEdgeInsets, cellData: TimelineCellData) { + @MainActor init(width: CGFloat, insets: UIEdgeInsets, cellData: TimelineCellData) { var currentPoint = CGPoint.zero currentPoint.x = TimelineDefaultCellLayout.cellPadding.left + insets.left + TimelineDefaultCellLayout.unreadCircleMarginLeft diff --git a/iOS/Timeline/Cell/TimelineCellLayout.swift b/iOS/Timeline/Cell/TimelineCellLayout.swift index 0e4ed37dd..8726b4ae7 100644 --- a/iOS/Timeline/Cell/TimelineCellLayout.swift +++ b/iOS/Timeline/Cell/TimelineCellLayout.swift @@ -50,8 +50,8 @@ extension TimelineCellLayout { return r } - static func rectForTitle(_ cellData: TimelineCellData, _ point: CGPoint, _ textAreaWidth: CGFloat) -> (CGRect, Int) { - + @MainActor static func rectForTitle(_ cellData: TimelineCellData, _ point: CGPoint, _ textAreaWidth: CGFloat) -> (CGRect, Int) { + var r = CGRect.zero if cellData.title.isEmpty { return (r, 0) @@ -71,7 +71,7 @@ extension TimelineCellLayout { } - static func rectForSummary(_ cellData: TimelineCellData, _ point: CGPoint, _ textAreaWidth: CGFloat, _ linesUsed: Int) -> CGRect { + @MainActor static func rectForSummary(_ cellData: TimelineCellData, _ point: CGPoint, _ textAreaWidth: CGFloat, _ linesUsed: Int) -> CGRect { let linesLeft = cellData.numberOfLines - linesUsed diff --git a/iOS/Timeline/Cell/TimelineDefaultCellLayout.swift b/iOS/Timeline/Cell/TimelineDefaultCellLayout.swift index f322d60c8..4c7bf8c76 100644 --- a/iOS/Timeline/Cell/TimelineDefaultCellLayout.swift +++ b/iOS/Timeline/Cell/TimelineDefaultCellLayout.swift @@ -51,7 +51,7 @@ struct TimelineDefaultCellLayout: TimelineCellLayout { let feedNameRect: CGRect let dateRect: CGRect - init(width: CGFloat, insets: UIEdgeInsets, cellData: TimelineCellData) { + @MainActor init(width: CGFloat, insets: UIEdgeInsets, cellData: TimelineCellData) { var currentPoint = CGPoint.zero currentPoint.x = TimelineDefaultCellLayout.cellPadding.left + insets.left + TimelineDefaultCellLayout.unreadCircleMarginLeft