Open SpectralDragon opened 3 years ago
I imagine this has to do with following closely to Godot's APIs for game developers using Godot that also want to use Swift (not to be confused with Swift developers that want to use Godot).
I assume this will change a bit over time, though.
can you give specific examples?
can you give specific examples?
It took me a minute to realize, but I think they're referring to the sample bits of code used in the documentation.
As a example, currently, we have this on the README:
final
class MySwiftClass:Godot.NativeScript
{
var foo:Int = 5
init(delegate _:Godot.Unmanaged.Spatial)
{
}
func bar(delegate _:Godot.Unmanaged.Spatial, x:Int) -> Int
{
self.foo * x
}
@Interface
static var interface:Interface
{
Interface.properties
{
\.foo <- "foo"
}
Interface.methods
{
bar(delegate:x:) <- "bar"
}
}
}
extension Godot.Library
{
@Interface
static var interface:Interface
{
MySwiftClass.self <- "MyExportedSwiftClass"
}
}
Where most Swift style guides would write the same code as:
final class MySwiftClass: Godot.NativeScript {
var foo: Int = 5
init(delegate _: Godot.Unmanaged.Spatial) {}
func bar(delegate _: Godot.Unmanaged.Spatial, x: Int) -> Int {
self.foo * x
}
@Interface static var interface: Interface {
Interface.properties {
\.foo <- "foo"
}
Interface.methods {
bar(delegate: x:) <- "bar"
}
}
}
extension Godot.Library {
@Interface static var interface:Interface {
MySwiftClass.self <- "MyExportedSwiftClass"
}
}
Exactly ^ gave me the impression that some non-Swift programmer made the Swift plugin - which is impressive :p btw I really hope @kelvin13 can keep up the effort and make this mature - thank you!
Why your examples and docs code using C# style guide instead of swift way
https://google.github.io/swift/
or
https://github.com/raywenderlich/swift-style-guide