Skip to content

Commit

Permalink
Added threadsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
juicyfru1t committed Oct 19, 2024
1 parent 996154b commit 23d9e07
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Sources/Addons/Sharing/Activity/SharingActivityManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,25 @@ internal final class SharingActivityManager<Activity: SharingCustomActivity>: UI
Activity.category
}

private var items: [SharingItem] = []
private let accessQueue = DispatchQueue(
label: "SharingActivityManager \(UUID().uuidString)",
qos: .userInitiated,
attributes: .concurrent
)

private var _items: [SharingItem] = []
private var items: [SharingItem] {
get {
accessQueue.sync {
_items
}
}
set {
accessQueue.async(flags: .barrier) { [weak self] in
self?._items = newValue
}
}
}

internal let navigator: ScreenNavigator
internal let activity: Activity
Expand Down

0 comments on commit 23d9e07

Please sign in to comment.