-
Notifications
You must be signed in to change notification settings - Fork 80
Closed
Labels
Description
In my attempts to understand swiftgen a bit more I'm trying to play with simple Swift concepts and expose bindings to them in Dart.
Given this simple Swift file
import Foundation
// enum '@objc' enum must declare an integer raw type
@objc enum CompassPoint: Int {
case north
case south
case east
case west
}
// struct
public struct Person {
var name: String
var age: Int
}
// class
@objc public class Dog : NSObject {
public var name: String
public var breed: String
public init(name: String, breed: String) {
self.name = name
self.breed = breed
}
}
// function
public func greet(person: Person) -> String {
return "Hello, \(person.name)!"
}
I'm trying to use current generate_code.dart
script to create bindings to Dog
, Person
, greet()
or CompassPoint
. I've learned some details from the error messages (e.g. '@objc' enum must declare an integer raw typ
) but I'm still not able to generate all the bindings:
- class
Dog
is accessible but cannot be initialized, properties are not generated greet
is not availablePerson
is not availableCompassPoint
is not available
Source code:
basic_swift.h
comes from manualswiftc -c basic_swift.swift -module-name basic_swift -emit-objc-header-path basic_swift.h -emit-library -o libbasicswift.dylib
- entire sample basic_swift.zip
I verified the Swift code can be run

Is there any way to make this code work with Dart?