Skip to content

Creating a Project

scd project init generates a complete multiplatform project in the current directory. Run it once when starting a new app.

Terminal window
mkdir MyApp && cd MyApp
scd project init

This uses the directory name as the project name and generates com.myapp.myapp as the package identifier. Pass --package-id to set it explicitly:

Terminal window
scd project init --package-id com.example.myapp
OptionDescription
-n, --nameProject name. Defaults to current directory name.
--package-idAndroid package / Apple bundle identifier. Defaults to com.<name>.<name>.
Terminal window
scd project init --name MyApp --package-id com.example.myapp
MyApp/
Packages/MyApp/
Package.swift
Sources/MyApp/
MyApp.swift
Android/MyApp/
app/
build.gradle.kts
src/main/
AndroidManifest.xml
java/com/example/myapp/
MainActivity.kt
build.gradle.kts
settings.gradle.kts
gradle/
libs.versions.toml
wrapper/
Apple/MyApp/
MyApp.xcodeproj/
project.pbxproj
project.xcworkspace/
Sources/
MyAppApp.swift
ContentView.swift
Assets.xcassets/

A Swift 6 dynamic library targeting macOS 14 and iOS 17, with a dependency on swift4j. The placeholder source file uses @jvm to mark the main class for export to Kotlin/Java:

import Swift4j
@jvm
public class MyApp {
public init() {}
public func greeting() -> String { "Hello from Swift!" }
}

Applies the SCADE SPM Gradle plugin and points it at the shared Swift package:

plugins {
id("com.android.application")
id("io.scade.gradle.plugins.android.swiftpm") version "latest.release"
}
swiftpm {
path = file("../../../Packages/MyApp")
product = "MyApp"
javaVersion = 8
scdAutoUpdate = true
}

The Gradle build handles Swift compilation, JNI bridging generation, and APK packaging automatically. See Gradle Plugin for the full configuration reference.

An Xcode project with two native targets:

TargetPlatformDeployment target
MyAppIOSiPhone + SimulatoriOS 17.0+
MyAppMacOSmacOSmacOS 14.0+

Both targets reference Packages/MyApp as a local Swift package. ContentView.swift calls MyApp().greeting() from the shared library.

After generating the project:

  • Build for one or more platforms with scd project build
  • Run on a device or simulator with scd project run
  • Edit Packages/MyApp/Sources/MyApp/MyApp.swift to add your shared Swift logic