Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Antoine/swift6 prep #46

Merged
merged 5 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ let package = Package(
]
),
],
swiftLanguageModes: [.v6]
swiftLanguageModes: [.v6, .v5]
)
1 change: 1 addition & 0 deletions Sources/StorybookKit/Primitives/Book.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public struct FolderBuilder {

public typealias Element = Book.Node

@MainActor
public static func buildExpression<Provider: BookProvider>(_ expression: Provider.Type) -> [FolderBuilder.Element] {
return [.page(expression.bookBody)]
}
Expand Down
1 change: 1 addition & 0 deletions Sources/StorybookKit/Primitives/BookProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import SwiftUI

@_alwaysEmitConformanceMetadata
public protocol BookProvider {
@MainActor
static var bookBody: BookPage { get }
}

Expand Down
1 change: 1 addition & 0 deletions Sources/StorybookMacrosPlugin/StorybookPageMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public struct StorybookPageMacro: DeclarationMacro {
.init(
stringLiteral: """
enum \(enumName): BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: \(title),
Expand Down
1 change: 1 addition & 0 deletions Sources/StorybookMacrosPlugin/StorybookPreviewMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public struct StorybookPreviewMacro: ExpressionMacro {
stringLiteral: """
{
enum \(enumName): BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: \(title),
Expand Down
8 changes: 8 additions & 0 deletions Sources/StorybookMacrosTests/StorybookPageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ final class StorybookPageTests: XCTestCase {
} expansion: {
"""
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: _typeName(UIView.self),
Expand Down Expand Up @@ -74,6 +75,7 @@ final class StorybookPageTests: XCTestCase {
} expansion: {
"""
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: "Path1.Path2.Title",
Expand Down Expand Up @@ -105,6 +107,7 @@ final class StorybookPageTests: XCTestCase {
"""
enum Namespace1 { enum Namespace2 { enum Namespace3 { class TestableView: UIView {} } } }
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: _typeName(target: Namespace1.Namespace2.Namespace3.TestableView.self),
Expand Down Expand Up @@ -132,6 +135,7 @@ final class StorybookPageTests: XCTestCase {
} expansion: {
"""
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: "Path1.Path2.Title",
Expand Down Expand Up @@ -163,6 +167,7 @@ final class StorybookPageTests: XCTestCase {
} expansion: {
"""
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: _typeName(UIView.self),
Expand Down Expand Up @@ -193,6 +198,7 @@ final class StorybookPageTests: XCTestCase {
} expansion: {
"""
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: "Path1.Path2.Title",
Expand Down Expand Up @@ -227,6 +233,7 @@ final class StorybookPageTests: XCTestCase {
"""
enum Namespace1 { enum Namespace2 { enum Namespace3 { class TestableView: UIView {} } } }
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: _typeName(
Expand Down Expand Up @@ -258,6 +265,7 @@ final class StorybookPageTests: XCTestCase {
} expansion: {
"""
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: "Path1.Path2.Title",
Expand Down
8 changes: 8 additions & 0 deletions Sources/StorybookMacrosTests/StorybookPreviewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ final class StorybookPreviewTests: XCTestCase {
#Preview("Some title") {
{
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: _typeName(UIView.self),
Expand Down Expand Up @@ -85,6 +86,7 @@ final class StorybookPreviewTests: XCTestCase {
#Preview {
{
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: "Path1.Path2.Title",
Expand Down Expand Up @@ -123,6 +125,7 @@ final class StorybookPreviewTests: XCTestCase {
#Preview {
{
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: _typeName(target: Namespace1.Namespace2.Namespace3.TestableView.self),
Expand Down Expand Up @@ -157,6 +160,7 @@ final class StorybookPreviewTests: XCTestCase {
#Preview {
{
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: "Path1.Path2.Title",
Expand Down Expand Up @@ -195,6 +199,7 @@ final class StorybookPreviewTests: XCTestCase {
#Preview {
{
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: _typeName(UIView.self),
Expand Down Expand Up @@ -232,6 +237,7 @@ final class StorybookPreviewTests: XCTestCase {
#Preview {
{
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: "Path1.Path2.Title",
Expand Down Expand Up @@ -273,6 +279,7 @@ final class StorybookPreviewTests: XCTestCase {
#Preview {
{
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: _typeName(
Expand Down Expand Up @@ -311,6 +318,7 @@ final class StorybookPreviewTests: XCTestCase {
#Preview {
{
enum __macro_local_20__🤖🛠️_StorybookMagic_fMu_: BookProvider {
@MainActor
static var bookBody: BookPage {
.init(
title: "Path1.Path2.Title",
Expand Down
Loading