-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Cannot import default iOS frameworks in Objective-C code #385
Comments
This usage is not currently supported. |
This allows specifying `-isysroot` on CLI arguments. Fixes #385
Wow, thanks for promptness! |
Related question.
... i get an empty output.
... i get all declarations from UITableView.h. Is there any filter that excludes any declarations from default iOS frameworks if I use a statement like (1)? |
What compiler arguments are you passing? I think you need to pass |
Exactly the same as suggested here: #387
Yet figuring out how to pass the -sdk argument. I.e.:
outputs |
SourceKitten is pretty dumb when it comes to compiler arguments. It just passes it to libclang. Xcode exists to translate GUI project settings into a complex soup of clang arguments. It's not exactly a process I fully understand or find intuitive either. Sorry. |
Well, I still have quite a few concerns. What compiler arguments are you passing? I think you need to pass -sdk for it to find the SDK. |
I'm trying to convert an Objective-C method declaration to Swift using the following command:
sourcekitten doc --objc test.h -- -target arm64-apple-ios10.3 -x objective-c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk -I $(pwd)
test.h:
declaration.h:
The returned output includes the following
key.swift_declaration
:func tableView(_ tableView: Any!, cellForRowAt indexPath: IndexPath!) -> Any!
Note that tableView and return type are incorrectly declared as
Any!
.If I copy UIKit.h to the same folder as test.h, and copy all files from
.../iPhoneOS10.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/
into a subfolder named
UIKit
, I get the expected output:func tableView(_ tableView: UITableView!, cellForRowAt indexPath: IndexPath!) -> UITableViewCell!
It seems that MacOS frameworks from /System/Library/Frameworks/ are correctly imported using a statement like
#import <Framework/Framework.h>
, but I can't figure out how to get iOS frameworks imported the same way.Already tried the following:
.../iPhoneOS10.3.sdk/System/Library/Frameworks
, or.../Frameworks/UIKit.framework/Headers
using -I compiler argument;FRAMEWORK_SEARCH_PATHS
argument;-sdk
parameter with the same value as-isysroot
;-workspace TestImports.xcodeproj/project.xcworkspace -scheme TestImports
Also interesting that if I change the define to something like
#import <UIKit/UIKit2.h>
I get an appropriate error message, which makes me think that the #import statement is recognized, but types likeUITableView
are not imported for some reason.Any hints appreciated!
The text was updated successfully, but these errors were encountered: