6

The article https://developer.xamarin.com/guides/cross-platform/macios/binding/ mentions how a native library written using Objective-C can be used in Xamarin. Is there any documentation available for doing the same with a native framework written in Swift? https://developer.xamarin.com/guides/ios/advanced_topics/embedded_frameworks/ talks about using embedded frameworks but it does not say anything about swift. Does the same thing work?

famousgarkin
  • 13,100
  • 5
  • 56
  • 74
Amruta
  • 425
  • 4
  • 16
  • Swift does not support creating static `.a` libraries, it only supports Framework creation. The only way that I currently know of is to create an ObjC static library and expose your Swift Framework via ObjC-based functions and then you can bind that to C#. – SushiHangover May 24 '16 at 05:03
  • @SushiHangover - if a project has any swift reference,then it can not be translated into .a library right ! but if it uses swift framework then its not the problem we can convert it into .a library.Correct me If I am wrong !If you have any working sample hosted in Github or something kindly consider sharing it – Durai Amuthan.H Mar 29 '17 at 09:43
  • @DuraiAmuthan.H I'm not sure what you mean... – SushiHangover Mar 29 '17 at 19:10
  • @SushiHangover - you have mentioned we can import a swift framework and we can expose Swift APIs through Objective C... and so we can get .a static library and which will be used for binding...Is my understanding right ? – Durai Amuthan.H Mar 29 '17 at 21:59

1 Answers1

4

Binding Swift libraries is not officially supported, but you can find a documentation on how to do it:

https://medium.com/@Flash3001/binding-swift-libraries-xamarin-ios-ff32adbc7c76

Lucas Teixeira
  • 694
  • 7
  • 11