migueldeicaza / SwiftGodotKit

Embed Godot into Swift apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Noob question - how to run the TrivialSample

hyouuu opened this issue · comments

commented

If I do swift main.swift then I get:

main.swift:10:8: error: no such module 'SwiftGodot'
import SwiftGodot

Do I create a Package.swift within the same folder or did I get this wrong completely?

Thanks!

Yes you need to have a Package.swift that references this module.

commented

Could you provide an example file? I tried this:

// swift-tools-version:5.8
import PackageDescription

let package = Package(
    name: "Banban",
    platforms: [
        .macOS(.v12),
    ],
    dependencies: [
        .package(url: "https://github.com/migueldeicaza/SwiftGodotKit.git", branch: "main")
    ],
    targets: [
        .target(name: "App", dependencies: [
            .product(name: "SwiftGodotKit", package: "SwiftGodotKit"),
        ]),
        .executableTarget(name: "Run", dependencies: [
            .target(name: "App"),
        ]),
    ]
)

And calling swift Package.swift gives Package.swift:2:8: error: no such module 'PackageDescription'

For context I only have the main.swift & Package.swift in the folder
Screenshot 2023-09-05 at 10 02 39 PM

Sorry I have only used Xcode's built in way to create projects and run them

You Can also create a sample Mac app, then reference this module and get started. Or use “swift package init”

commented

mmm now I get this error - thoughts? It'll be greatly helpful if a Mac sample app is included 😄

Screenshot 2023-09-06 at 10 50 51 AM

I added a standalone example to show how it works:

https://github.com/migueldeicaza/SwiftGodotKit/tree/main/StandaloneExample

And I packed a sample program with Xcode here:

https://tirania.org/tmp/SwiftGodotApp.tar.gz

commented

Perfect thank you so much!!