Skip to content

Commit

Permalink
Updates for xcode beta (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahsmartin authored Jun 10, 2024
1 parent 3274d8d commit e5bf73a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/PreviewGallery/PreviewData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public struct PreviewData {
Set(previews.map { $0.module })
}

public static var `default`: PreviewData {
@MainActor public static var `default`: PreviewData {
self.init(previews: findPreviews())
}
}
5 changes: 3 additions & 2 deletions Sources/PreviewGallery/PreviewGallery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ public struct PreviewGallery: View {

let data: PreviewData

public init(data: PreviewData = .default) {
self.data = data
@MainActor
public init(data: PreviewData? = nil) {
self.data = data ?? .default
}

public var body: some View {
Expand Down
2 changes: 2 additions & 0 deletions Sources/SnapshotPreviewsCore/SnapshotPreviewsCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public struct PreviewType: Hashable, Identifiable {

#if compiler(>=5.9)
@available(iOS 17.0, macOS 14.0, *)
@MainActor
init?<A: PreviewRegistry>(typeName: String, registry: A.Type) {
self.typeName = typeName
self.fileID = A.fileID
Expand Down Expand Up @@ -142,6 +143,7 @@ public struct PreviewType: Hashable, Identifiable {
public let platform: PreviewPlatform?
}

@MainActor
public func findPreviews(
shouldInclude: (String, String) -> Bool = { _, _ in true },
willAccess: (String) -> Void = { _ in }) -> [PreviewType]
Expand Down

0 comments on commit e5bf73a

Please sign in to comment.