Fix DraftAttachment being accessed off main thread

This commit is contained in:
Shadowfacts 2023-04-22 22:03:52 -04:00
parent bff1ea8b9d
commit 2249e5a315
1 changed files with 1 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import Foundation
import Pachyderm
import UniformTypeIdentifiers
@MainActor
class PostService: ObservableObject {
private let mastodonController: ComposeMastodonContext
private let config: ComposeUIConfig
@ -26,7 +27,6 @@ class PostService: ObservableObject {
self.totalSteps = 2 + (draft.attachments.count * 2)
}
@MainActor
func post() async throws {
guard draft.hasContent else {
return
@ -65,7 +65,6 @@ class PostService: ObservableObject {
}
}
@MainActor
private func uploadAttachments() async throws -> [Attachment] {
var attachments: [Attachment] = []
attachments.reserveCapacity(draft.attachments.count)