Compound - Swift 6.2 and Main actor isolation (#5109)

* compound is now using 6.2 and main actor isolation + some tweaks to make it build tests and EX

* better handling of the nonisolated context for CompoundUIColors

* improving docs

* fix comment

* remove unused Sendable conformance
This commit is contained in:
Mauro
2026-02-16 11:19:12 +01:00
committed by GitHub
parent b4eedfef59
commit 26bfa6ed7c
20 changed files with 65 additions and 34 deletions
@@ -10,11 +10,11 @@ import SwiftUI
extension View {
func progressMask(progress: CGFloat,
trackColor: Color = .compound.iconSecondary,
backgroundTrackColor: Color = .compound.iconQuaternary) -> some View {
trackColor: @autoclosure @MainActor () -> Color = .compound.iconSecondary,
backgroundTrackColor: @autoclosure @MainActor () -> Color = .compound.iconQuaternary) -> some View {
modifier(ProgressMaskModifier(progress: progress,
trackColor: trackColor,
backgroundTrackColor: backgroundTrackColor))
trackColor: trackColor(),
backgroundTrackColor: backgroundTrackColor()))
}
}
@@ -10,6 +10,7 @@ import Compound
import SwiftUI
import SwiftUIIntrospect
@MainActor
extension TextFieldStyle where Self == ElementTextFieldStyle {
static func element(labelText: String? = nil,
footerText: String? = nil,
@@ -34,6 +35,7 @@ extension TextFieldStyle where Self == ElementTextFieldStyle {
}
/// The text field style used in authentication screens.
@MainActor
struct ElementTextFieldStyle: @MainActor TextFieldStyle {
enum State {
case success
@@ -8,6 +8,7 @@
import SwiftUI
@MainActor
struct RoomInviterDetails: Equatable {
let id: String
let displayName: String?
@@ -9,6 +9,7 @@ import Compound
import SwiftUI
struct ToolbarButton: View {
@MainActor
enum Role {
static let cancel = Role.cancel(title: L10n.actionCancel)
static let done = Role.confirm(title: L10n.actionDone)
@@ -128,6 +128,7 @@ struct RoomMembersListScreen: View {
}
}
@MainActor
private enum MembersSection {
case joined
case invited
@@ -38,6 +38,7 @@ struct FormattingToolbar: View {
}
}
@MainActor
private extension FormatItem {
var foregroundColor: Color {
switch state {
@@ -109,6 +109,7 @@ enum RoomScreenFooterViewDetails {
case verificationViolation(member: RoomMemberProxyProtocol, learnMoreURL: URL)
}
@MainActor
enum PinnedEventsBannerState: Equatable {
case loading(numbersOfEvents: Int)
case loaded(state: PinnedEventsState)
@@ -213,6 +214,7 @@ enum PinnedEventsBannerState: Equatable {
}
}
@MainActor
struct PinnedEventsState: Equatable {
var pinnedEventContents: OrderedDictionary<String, AttributedString> = [:] {
didSet {
@@ -243,6 +243,7 @@ private struct VerifiedUserSendFailureView: View {
}
}
@MainActor
private extension EncryptionAuthenticity {
var foregroundStyle: SwiftUI.Color {
switch color {
@@ -16,10 +16,10 @@ extension View {
/// - color: self explanatory, defaults to subtle secondary
func bubbleBackground(isOutgoing: Bool = true,
insets: EdgeInsets = .init(top: 8, leading: 12, bottom: 8, trailing: 12),
color: Color? = .compound.bgSubtleSecondary) -> some View {
color: @autoclosure @MainActor () -> Color? = .compound.bgSubtleSecondary) -> some View {
modifier(TimelineItemBubbleBackgroundModifier(isOutgoing: isOutgoing,
insets: insets,
color: color))
color: color()))
}
}
@@ -238,6 +238,7 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
}
}
@MainActor
private extension EventBasedTimelineItemProtocol {
var bubbleBackgroundColor: Color? {
let defaultColor: Color = isOutgoing ? .compound._bgBubbleOutgoing : .compound._bgBubbleIncoming
@@ -112,6 +112,7 @@ private struct TimelineItemSendInfoLabel: View {
}
/// All the data needed to render a timeline item's send info label.
@MainActor
private struct TimelineItemSendInfo {
enum Status {
case sendingFailed
@@ -185,6 +186,7 @@ private extension TimelineItemSendInfo {
}
}
@MainActor
private extension EncryptionAuthenticity {
var foregroundStyle: SwiftUI.Color {
switch color {