Everybody knows, that is very simple in XCode, there are many tutorials, for example,
or
But I read in some sources, that that is impossible in Linux (I have Ubuntu 15) for open source swift compiler. Is it true?
I mean, for example, such simple code:
file C.h #import <Foundation/NSObject.h> @interface C : NSObject @property (copy) NSString *cu; @end
Swift only implements ObjC interop with Apple's ObjC runtime on iOS/tvOS/watchOS and 64-bit Mac. It could be ported to other runtimes in theory, but someone would have to do that work.
-Joe
···
On Feb 1, 2016, at 4:46 AM, Труб Илья via swift-dev <swift-dev@swift.org> wrote:
But I read in some sources, that that is impossible in Linux (I have Ubuntu 15) for open source swift compiler. Is it true?
I mean, for example, such simple code:
file C.h import <Foundation/NSObject.h> @interface C : NSObject @property (copy) NSString *cu; @end
I'd like to note some interesting issue. If I try to input
swiftc -c s.swift -Xcc -I<paths to my headers, including path to Foundation/NSObject.h> -import-objc-header C.h
then I get a lot of compile errors on ALL ObjectiveC code lines in NSObject.h, so, it seems that compiler does not recognize Objective C syntax at all.
But, if I (in another example) use -import-objc-header <pure C header file>
that all is OK: .swift source file with function invocations from pure C .h-file compiled successfully, .o-file is created. What is explanation of such phenomena and how it could be overcomed?
Em seg, 1 de fev de 2016 às 13:09, Труб Илья <swift-dev@swift.org> escreveu:
I'd like to note some interesting issue. If I try to input
swiftc -c s.swift -Xcc -I<paths to my headers, including path to
Foundation/NSObject.h> -import-objc-header C.h
then I get a lot of compile errors on ALL ObjectiveC code lines in
NSObject.h, so, it seems that compiler does not recognize Objective C
syntax at all.
But, if I (in another example) use -import-objc-header <pure C header file>
that all is OK: .swift source file with function invocations from pure C
.h-file compiled successfully, .o-file is created. What is explanation of
such phenomena and how it could be overcomed?