Skip to content

Commit

Permalink
Antoine/swift6 prep (#46)
Browse files Browse the repository at this point in the history
The macro expansion causes warnings with swift 6. This is problematic
because it belongs to the client module and blocks downstream swift6
compilation
  • Loading branch information
ntnmrndn authored Nov 13, 2024
1 parent dc9f29f commit 4e0e90d
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 1 deletion.
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

0 comments on commit 4e0e90d

Please sign in to comment.