Add @MainActor to some view methods

This commit is contained in:
1024jp 2024-03-12 07:10:05 +09:00
parent 8e9a049270
commit af9d522c70
3 changed files with 6 additions and 5 deletions

View File

@ -59,7 +59,7 @@ struct FindPanelResultView: View {
typealias Match = TextFindAllResult.Match
final class Model: ObservableObject {
@MainActor final class Model: ObservableObject {
@Published var matches: [Match] = []
@Published var findString: String = ""
@ -153,7 +153,7 @@ struct FindPanelResultView: View {
}
private var message: String {
@MainActor private var message: String {
let documentName = self.model.target?.documentName ?? "Unknown" // This should never be nil.

View File

@ -180,7 +180,7 @@ struct SyntaxEditView: View {
}
@ViewBuilder private var detailView: some View {
@MainActor @ViewBuilder private var detailView: some View {
switch self.pane {
case .keywords:
@ -220,7 +220,7 @@ struct SyntaxEditView: View {
// MARK: Private Methods
/// Submits the syntax if it is valid.
private func submit() {
@MainActor private func submit() {
// syntax name validation
self.name = self.name.trimmingCharacters(in: .whitespacesAndNewlines)
@ -249,7 +249,7 @@ struct SyntaxEditView: View {
/// Restores the current settings in editor to the user default.
private func restore() {
@MainActor private func restore() {
guard
self.isBundled,

View File

@ -55,6 +55,7 @@ struct ValueRange<Value> {
extension ValueRange: Equatable where Value: Equatable { }
extension ValueRange: Hashable where Value: Hashable { }
extension ValueRange: Sendable where Value: Sendable { }
extension ValueRange: Identifiable where Self: Hashable {