Use a shared library in XCode

i created with Oxygene a static library for OSX with following class:

namespace ClassLibraryNET;

interface

type
  Class1 = public class
  private
  protected
  public
    method Sum(a,b : Integer) : Integer;
  end;
  
implementation

method Class1.Sum(a: Integer; b: Integer): Integer;
begin
 Result := a+b;
end;

end.

how can i use this class in a an xcode swift commandline project?

i added the generated StaticLibraryOSX.a to the project, but now, how can i import the Class1 ?

sorry for the beginner question…

There should be a .h file next to the .a, this can be used as a plain objc header, then this should work:
https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html

FTR, There’s an option to turn generation of this file on or off, i forgot what it’s called in VS right now. But it should be on my default, for library projects.

It works, great :slight_smile:

1 Like