Skip to content

Commit b792e53

Browse files
committed
Sendable
1 parent b5bb310 commit b792e53

13 files changed

Lines changed: 23 additions & 19 deletions

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 5.9
1+
// swift-tools-version: 6.2
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription

Sources/DebugMenu/DebugMenu.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import UIKit
22

33
@available(iOSApplicationExtension, unavailable)
44
public struct DebugMenu {
5+
6+
@MainActor
57
public static func install(
68
windowScene: UIWindowScene? = nil,
79
items: [DebugItem] = [],

Sources/DebugMenu/Entity/Application.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22

33
public class Application {
4-
public static var current: Application = .init()
4+
public static var current: Application { Application() }
55

66
public var appName: String {
77
Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as! String

Sources/DebugMenu/Entity/Device.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import UIKit
22

3-
public class Device {
4-
public static let current: Device = .init()
3+
@MainActor
4+
public final class Device {
5+
public static var current: Device { Device() }
56

67
public var localizedModel: String {
78
UIDevice.current.localizedModel

Sources/DebugMenu/Entity/Device/GPU.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import Foundation
22
import Metal
33

4-
class GPU {
5-
static var current: GPU = .init()
4+
final class GPU {
5+
static var current: GPU { GPU() }
66
let device: MTLDevice
77

88
init() {

Sources/DebugMenu/Entity/Options.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import Foundation
22
import UIKit
33

4-
public enum Options {
4+
public enum Options: Sendable {
55
case showsWidgetOnLaunch
66
case showsRecentItems
77
case launchIcon(LaunchIcon)
88

9-
public struct LaunchIcon {
9+
public struct LaunchIcon: Sendable {
1010
public typealias Position = FloatingItemGestureRecognizer.Edge
1111

1212
let image: UIImage?
@@ -21,7 +21,7 @@ public enum Options {
2121
}
2222
}
2323

24-
public static var `default`: [Options] = [.showsRecentItems]
24+
public static var `default`: [Options] { [.showsRecentItems] }
2525

2626
var isShowsWidgetOnLaunch: Bool {
2727
if case .showsWidgetOnLaunch = self { return true }

Sources/DebugMenu/Extensions/FloatingItemGestureRecognizer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public class FloatingItemGestureRecognizer: UIPanGestureRecognizer {
44
private weak var groundView: UIView?
55
private var gestureGap: CGPoint?
66
private let margin: CGFloat = 16
7-
public enum Edge {
7+
public enum Edge: Sendable {
88
case top
99
// case center
1010
case bottom
@@ -26,7 +26,7 @@ public class FloatingItemGestureRecognizer: UIPanGestureRecognizer {
2626

2727
}
2828

29-
deinit {
29+
@MainActor deinit {
3030
self.removeTarget(self, action: #selector(pan(_:)))
3131
}
3232

Sources/DebugMenu/Plugin/DebugMenu/CaseSelectableDebugItem.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import UIKit
22

3-
public struct CaseSelectableDebugItem<T: CaseIterable & RawRepresentable>: DebugItem
3+
public struct CaseSelectableDebugItem<T: CaseIterable & RawRepresentable & Sendable>: DebugItem
44
where T.RawValue: Equatable {
5-
public init(currentValue: T, didSelected: @escaping (T) -> Void) {
5+
public init(currentValue: T, didSelected: @escaping @Sendable @MainActor (T) -> Void) {
66
self.action = .didSelect { controller in
77
let vc = CaseSelectableTableController<T>(
88
currentValue: currentValue,

Sources/DebugMenu/Plugin/DebugMenu/KeyValueDebugItem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Foundation
33
public struct KeyValueDebugItem: DebugItem {
44
public init(
55
title: String,
6-
fetcher: @escaping () async -> [Envelope]
6+
fetcher: @escaping @Sendable @MainActor () async -> [Envelope]
77
) {
88
self.title = title
99
self.action = .didSelect(operation: { parent in

Sources/DebugMenu/Plugin/DebugMenu/UI/CaseSelectableTableController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import Foundation
22
import UIKit
33

4-
public class CaseSelectableTableController<T: CaseIterable & RawRepresentable>:
4+
public class CaseSelectableTableController<T: CaseIterable & RawRepresentable & Sendable>:
55
UITableViewController
66
where T.RawValue: Equatable {
77
public let currentValue: T
88
public let didSelected: (T) -> Void
99
private var selectedIndex: IndexPath? = nil
1010

11-
public init(currentValue: T, didSelected: @escaping (T) -> Void) {
11+
public init(currentValue: T, didSelected: @escaping @Sendable @MainActor (T) -> Void) {
1212
self.currentValue = currentValue
1313
self.didSelected = didSelected
1414
super.init(style: .grouped)

0 commit comments

Comments
 (0)