To add Leaf-rendering support to our Vapor application, we will need to use Leaf Provider. It uses the same Leaf package under the hood, but implements Vapor's Provider protocol so that it can be used without writing much code and specifying it as our view renderer in the droplet.json config. To add Leaf Provider to our Vapor app, we will need to perform theĀ following steps:
- Open up our ShoppingListServer Xcode project and add leaf-provider as a dependency inside our Package.swift:
.package(url: "https://github.com/vapor/leaf-provider.git", .upToNextMajor(from: "1.1.0")),
- Next, specify it as a dependency for our App target:
.target(name: "App", dependencies: ["Vapor", "FluentProvider", "HealthcheckProvider", "MongoProvider", "LeafProvider"],
- Now, open up the Config...