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

Dynamic loading of BookProvider conformers + new #StorybookPage macro #35

Merged
merged 15 commits into from
Feb 20, 2024

Conversation

JohnEstropia
Copy link
Member

@JohnEstropia JohnEstropia commented Feb 20, 2024

#StorybookPage macro:

#StorybookPage<Namespace.MyView> {
  VStack {
    MyView()
    Text("test")
  }
  .tint(.accentColor)
}
#StorybookPage(title: "My View") {
  VStack {
    MyView()
    Text("test")
  }
  .tint(.accentColor)
}

Dynamically loading of all BookProvider

Search only #StorybookPage macro usages

struct RootView: View {
  var body: some View {
    StorybookDisplayRootView(
      bookStore: .init(
        book: .init(title: "#StorybookPage macro") {
          Book.allStorybookPages()
            .map({ $0.bookBody })
        }
      )
    )
  }
}

Search all BookProvider conformances, including #StorybookPage macro usages

struct RootView: View {
  var body: some View {
    StorybookDisplayRootView(
      bookStore: .init(
        book: .init(title: "All BookProviders") {
          Book.allBookProviders()
            .map({ $0.bookBody })
        }
      )
    )
  }
}

Other changes

  • Updated Demo app to include both uses of previous Book declaring methods and the new #StorybookPage usage
  • Changed #file usages to #fileID to hide machine usernames in paths
  • Reorganized source file directories

@JohnEstropia JohnEstropia requested a review from muukii February 20, 2024 05:32
Copy link
Member

@muukii muukii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's go

@JohnEstropia JohnEstropia merged commit 8c716b5 into main Feb 20, 2024
2 checks passed
@JohnEstropia JohnEstropia deleted the john/dynamicLoading branch February 20, 2024 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants