0
votes

In XCode, you can browse Objective C Header/Documentation Files using Command + Shift + O.

For example, if you type in UISegmentedControl, only the Obj C version comes up.

If you Command click UISegmentedControl anywhere in code, the Swift version exists.

Is there a way to see Swift version through the Search Shortcut?

2
It looks like you can't in a project that contains Objective-C as a swift only project will open the .swift file. It still shows the .h file icon next to the name, but clicking on it will open the .swift file. You could file a radar on this (bugreport.apple.com) if you would like this feature to implemented. If this is the expected behavior, perhaps the idea is if you have Obj-C in your project, it is likely your preferred language so that's what they show. - timgcarlson
@timgcarlson Thanks. - ericgu

2 Answers

1
votes

It seems to work if you open it from within a Swift file you've created. Maybe then it's showing a bridging header or something?

While in the Swift ViewController generated by a test project, I can Cmd-Shift-O and select UISegmentedControl.h, or UITableView.h and the result shows up only in Swift.

But, if I then try to open a different file from within that one, even though the current file is in Swift, it only shows Obj-C. The language of the file doesn't seem to be as important as the .swift extension.

Seems to be the same if you Cmd-click and view the documentation - it'll show whichever language you came from. XCode6 seems to still be a bit screwy w/this though - about 2 steps in I keep getting "Symbol Not Found" even for basic things like UIView :\

Might as well just look at SwiftDoc.org.

0
votes

Click on the Swift logo bird at the right of the cmd+shift+o window so it turns blue, congrats you've turn on "Swift generated interface" if possible for the searched files