Skip to content

Dependency injection test implementation #1

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mallexxx
Copy link
Owner

@mallexxx mallexxx commented May 23, 2023

Macros are an experimental feature, so you will need a custom Swift toolchain and some extra compiler flags. The Xcode project in this repository is a good starting point. To use it:

  1. Download a development snapshot of the compiler from Swift.org from May 10, 2023 or later. At present, we only have these working on macOS, but are working to get other platforms working with other build systems.
  2. Clone the repo:
    git clone -b dependency-injection github.com:mallexxx/swift-macro-dependency-injection.git
    
  3. Build the example project in Xcode:
    a. Open MacroExamples.xcodeproj in Xcode
    b. Go to the Xcode -> Toolchains menu and select the development toolchain you downloaded.
    c. Make sure the DependencyInjection scheme is selected, then build and run!
  • !!! The first build will fail! Build again. Then build again!

  • Head to the DependencyInjection/main.swift for the sources

  • uncomment DependencyInjection/main.swift:150 to see how compile-time dependency graph checking works

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.

1 participant