ge-org / multiplatform-swiftpackage

Gradle plugin that generates a Swift Package Manager manifest and an XCFramework to distribute a Kotlin Multiplatform library for Apple platforms.
Apache License 2.0
336 stars 49 forks source link

Declare custom Package.swift template and its properties #11

Open ge-org opened 3 years ago

ge-org commented 3 years ago

DSL Syntax

import com.chromaticnoise.multiplatformswiftpackage.dsl.TemplateKey.*

multiplatformSwiftPackage {
    packageTemplate(File(project.projectDir, "custom-package.template")) {
        packageName = "customized" // some properties can be accessed directly
        set("myProp", "my custom value") // custom key/value pairs can be added
        set(ToolsVersion, "42") // all default keys can be accessed in type-safe manner
    }
}

TODOs

sebarthel89 commented 3 years ago

Looking forward to this PR. I tried to import a created swift package, but it failed by not finding a Package.swift .

SomeProject has no Package.swift manifest
ge-org commented 3 years ago

Hi @sebarthel89,

how did you add the Package.swift file to the project? This should already be possible without this PR. It should work by executing ./gradlew createSwiftPackage and then dragging the swiftpackage folder into the Xcode project. Then add the XCFramework to the Frameworks, Libraries, and Embedded Content section in the project settings.