# Introducing the Swift plugins

DevFeed: [Introducing the Swift plugins](<https://devfeed.tech/articles/introducing-the-swift-plugins-24657.md>)

Original publisher: [Read original article](<https://blog.gradle.org/introducing-the-swift-plugins>)

Author: Daniel Lacasse

Published: 2019-09-05T04:00:00Z

Content type: article

Language: en

Sources: [The Gradle Blog](<https://devfeed.tech/sources/the-gradle-blog.md>)

Topics: [Swift](<https://devfeed.tech/topics/swift.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [Dependency management](<https://devfeed.tech/topics/dependency-management.md>), [Xcode](<https://devfeed.tech/topics/xcode.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [macOS](<https://devfeed.tech/topics/macos.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [ide](<https://devfeed.tech/topics/ide.md>)

Tags: [compiler](<https://devfeed.tech/tags/compiler.md>), [dependency-management](<https://devfeed.tech/tags/dependency-management.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [ide](<https://devfeed.tech/tags/ide.md>), [linux](<https://devfeed.tech/tags/linux.md>), [macos](<https://devfeed.tech/tags/macos.md>), [swift](<https://devfeed.tech/tags/swift.md>), [xcode](<https://devfeed.tech/tags/xcode.md>)

## AI overview

This article introduces Gradle's native Swift plugins for building Swift libraries and applications on macOS and Linux with the official Swift compiler. It demonstrates application builds, configurable source layouts, Xcode workspace generation, dependency management, transitive dependencies, and XCTest support.

## Source excerpt

This post introduces some new native plugins that we've been working on that can build Swift libraries and applications. They work on both macOS and Linux with the official Swift compiler. The plugins take advantage of the many features baked into Gradle core, such as a rich dependency management engine as well as source dependencies, build cache, composite builds, finer grained parallel execution, build scans, and more. Note that, unfortunately, the plugins can't be used out of the box to build iOS application and libraries. If you'd like to provide feedback, please get in touch with us. Building an application You can find all of the samples from this post in the Gradle native samples GitHub repository. Let's look at building a simple application. The build script should look familiar to anyone who has used Gradle's Java plugins: plugins { id 'swift-application' } This application has no dependencies, and the Swift source files are located in the default location: the src/main/swift directory. Since this is Gradle, you can easily configure the source locations to match whatever layout your project requires, including the common Swift package manager pattern. Here's the result of running ./gradlew assemble on this sample: Take a look at the build scan for this build to see what happened in more detail. The plugins automatically find the compiler, linker and other tools to build the application. The result ends up installed in the build/install directory ready to run. IDE support Xcode is currently supported for Swift projects. You can just run ./gradlew openXcode. Gradle will generate the workspace and open the generated workspace in Xcode. Support for other IDEs will be gradually added. Here is the result of running ./gradlew openXcode on the sample: This is how the workspace looks in Xcode: Dependencies The plugin uses Gradle's dependency management features, just like other plugins such as the Java or Android plugins. This means, for example, transitive dependen