Skip to content

Commit e5bf73a

Browse files
authored
Updates for xcode beta (#123)
1 parent 3274d8d commit e5bf73a

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

Sources/PreviewGallery/PreviewData.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public struct PreviewData {
2323
Set(previews.map { $0.module })
2424
}
2525

26-
public static var `default`: PreviewData {
26+
@MainActor public static var `default`: PreviewData {
2727
self.init(previews: findPreviews())
2828
}
2929
}

Sources/PreviewGallery/PreviewGallery.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ public struct PreviewGallery: View {
3030

3131
let data: PreviewData
3232

33-
public init(data: PreviewData = .default) {
34-
self.data = data
33+
@MainActor
34+
public init(data: PreviewData? = nil) {
35+
self.data = data ?? .default
3536
}
3637

3738
public var body: some View {

Sources/SnapshotPreviewsCore/SnapshotPreviewsCore.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public struct PreviewType: Hashable, Identifiable {
9494

9595
#if compiler(>=5.9)
9696
@available(iOS 17.0, macOS 14.0, *)
97+
@MainActor
9798
init?<A: PreviewRegistry>(typeName: String, registry: A.Type) {
9899
self.typeName = typeName
99100
self.fileID = A.fileID
@@ -142,6 +143,7 @@ public struct PreviewType: Hashable, Identifiable {
142143
public let platform: PreviewPlatform?
143144
}
144145

146+
@MainActor
145147
public func findPreviews(
146148
shouldInclude: (String, String) -> Bool = { _, _ in true },
147149
willAccess: (String) -> Void = { _ in }) -> [PreviewType]

0 commit comments

Comments
 (0)