[swift-dev] Using Objective C class in Swift (open source, Linux)

Труб Илья itrub at yandex.ru
Fri Feb 12 05:13:21 CST 2016


As Joe suggested, I try to build swiftc and libSwiftCore on linux with some OpenSource ObjC runtime. Now, I have successfully built swiftc, but when building Swift.o, it generates a lot of homogenous errorsl for example:

home/itrub/swift-root/swift/stdlib/public/core/ObjCMirrors.swift:23:45: error: argument type '_swift_shims_CFStringRef' (aka 'UnsafeMutablePointer<objc_object>') does not conform to expected type '_CocoaStringType' (aka 'AnyObject')
  return _cocoaStringToSwiftString_NonASCII(theDescription)
                                            ^~~~~~~~~~~~~~
/home/itrub/swift-root/swift/stdlib/public/core/StringBridge.swift:27:54: error: cannot convert value of type '_CocoaStringType' (aka 'AnyObject') to expected argument type '_swift_shims_CFStringRef' (aka 'UnsafeMutablePointer<objc_object>')
  let result = _swift_stdlib_CFStringCreateCopy(nil, source)

There are also other errors, but all of them concern with mutual convertation of AnyObject and UnsafeMutablePointer<objc_object> or UnsafeMutablePointer<U>. Could somebody hint me direction of further researches? What swift compiler code and existence of which Objc-runtime functions I have to check firstly? 


More information about the swift-dev mailing list