I’m having a hard time getting my head around shared projects / modules using Swift in Fire.
Let’s suppose I have two hypothetical libraries: Library1
and Library2
. Both contain a single class called Analyser
and both Analyser
classes have a single method called Analyse()
.
I have a macOS console app that wants to be able to use both libraries and create instances of Library1.Analyser
and Library2.Analyser
.
In C# I have created two shared projects, one called Library1
and the other called Library2
. I have dragged them into the references folder in the navigator in my macOS project in Fire. The navigator looks like this:
I am able to happily do this in the main Program.cs
file:
namespace ConsoleApplication
{
static class Program
{
public static Int32 Main(string[] args)
{
Library1.Analyser a1 = new Library1.Analyser();
a1.Analyse();
Library2.Analyser a2 = new Library2.Analyser();
a2.Analyse();
}
}
}
If I do the exact same thing with Swift nothing will build because the compiler complains: "Analyser.swift, line 2 - (E58) Duplicate method "func Analyse()" with same signature"
.
It feels to me like Swift is unable to have two modules (?) / shared projects referenced that contain same named classes. Is this the case? I think I must be misunderstanding how to use shared projects in Swift (I’m coming from a C# background).
Can someone please explain to me how I can achieve in Swift what I described as working in C#?