Hi there, we are having this problem on Fire 8.3.91.1965 when compiling to java:
public class Foo
{
let name: String
public init(name: String)
{
self.name = name
}
}
public class X
{
static public func getFiltered(items: [Foo], name: String) -> [Foo]
{
// error E62: Type mismatch, cannot assign "Iterable<Foo>" to "swift.Array<Foo>"
// appending .toSwiftArray() fixes in Fire but this but won't work in Xcode
return items.filter { $0.name == name }
}
}
print("Hi")
Since iteration works on Iterables you can work around it like this but it’s pretty clunky:
public class X
{
static public func getFiltered(items: [Foo], name: String) -> [Foo]
{
let filtered = items.filter { $0.name == name }
var x: [Foo] = []
for f in filtered
{
x.append(f)
}
return x
}
}
It’s a little odd how apple converts it straight to an array but there we go. What do you reckon?