Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ntnmrndn committed Nov 13, 2024
1 parent 89b1114 commit 1c08354
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
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
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
1 change: 1 addition & 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

0 comments on commit 1c08354

Please sign in to comment.