Skip to content

Commit

Permalink
Fix Sharing crash iOS 16
Browse files Browse the repository at this point in the history
  • Loading branch information
juicyfru1t committed Oct 19, 2024
1 parent 2ca2d75 commit 996154b
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions Sources/Addons/Sharing/Activity/SharingActivityManager.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#if canImport(UIKit) && os(iOS)
import UIKit

@MainActor
internal final class SharingActivityManager<Activity: SharingCustomActivity>: UIActivity, Sendable {
internal final class SharingActivityManager<Activity: SharingCustomActivity>: UIActivity, @unchecked Sendable {

internal override class var activityCategory: UIActivity.Category {
Activity.category
Expand All @@ -14,21 +13,15 @@ internal final class SharingActivityManager<Activity: SharingCustomActivity>: UI
internal let activity: Activity

internal override var activityType: UIActivity.ActivityType? {
MainActor.assumeIsolated {
activity.type
}
activity.type
}

internal override var activityTitle: String? {
MainActor.assumeIsolated {
activity.title
}
activity.title
}

internal override var activityImage: UIImage? {
MainActor.assumeIsolated {
activity.image
}
activity.image
}

internal override var activityViewController: UIViewController? {
Expand All @@ -55,16 +48,12 @@ internal final class SharingActivityManager<Activity: SharingCustomActivity>: UI

internal override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
let activityItems = activityItems.map(SharingItem.init(activityItem:))
return MainActor.assumeIsolated {
activity.isApplicable(for: activityItems)
}
return activity.isApplicable(for: activityItems)
}

internal override func prepare(withActivityItems activityItems: [Any]) {
let activityItems = activityItems.map(SharingItem.init(activityItem:))
MainActor.assumeIsolated {
items = activityItems
}
items = activityItems
}

internal override func perform() {
Expand Down

0 comments on commit 996154b

Please sign in to comment.