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?
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.
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
Related
[![enter image description here][1]][1]I Tried all possible setting manipulation of xcode, even i cleaned xcode app from my mac and then reinstalled too, but still no luck, But Breakpoints works on almost all calsses except some , later on breakpoint navigator i noticed classes on which breakpoint not working are marked RED. I am wondering what is the actual cause ?
Update : After i removed ad added that specific file the red mark are gone, but result is not improved !
I see red text color labels so probably you have deleted files.
If your files exist and you dont see any breakpoint stopped in your class simply it's because your project probably crash before arriving in this class or by-pass it. Check who call DriveCreateAccountVC in your code and put some breakpoints before this class is called in the code, Im pretty sure you find your mistake.
It's a good attitude use the debug console by printing your flow in your code like this line for example: (you can put in viewDidAppear or viewDidLoad)
print("∙ \(NSStringFromClass(self.dynamicType))")
it's a little help but print the class name where are your flow in this moment. You can go also on the debug console and writing for example:
po myStringArray.description
po myStringArray.count
Another useful thing is to add these two options in your editing settings (it's not in defaults settings) : (line numbers and code folding ribbon)
A class becomes Red, when it has lost its path(Xcode can't locate the class)
This may happen because you maybe you copied flies from one project to another or something like that:
There are 2 solutions:
Before anything, locate the files in your Finder
Solution 1) Find the files and put them in your project directory.
Solution 2) Click the file in red in your Project Navigator
Then click on the button (showed in the image link above, to the right of tweetCell.swift)
Once you click it, you will get a chance to locate the file, do it.
In XCode 7.2.1, when working in swift code, I can command tap a function and it will bring me directly to the swift source code where that func is declared.
However, if I tap the same function from objective-c code, it brings you to the Swift.h Generated header file - not a very useful place.
Is there a way to go more directly to a function to the swift code using a key + tap combination? Currently, I have to command + space and type in the class name/function and choose it from Open Quickly, which is not ideal.
No, there isn't. The problem seems to be that Objective-C can't "see" Swift at all; all it sees is, as you rightly say, the generated "...-Swift.h" bridging header. This would make an excellent enhancement request at http://bugreport.apple.com (though whether anything can actually be done is anybody's guess).
So, I found myself craving a framework to replicate iOS 6 folders animation. Luckily I found one called JWFolders, which is pretty neat and useful, but my problem is the following:
I am doing my program in Swift, in Xcode 6.3, I imported the header file to the bridging thingy in the swift compiler settings, and as long as I don't try to use anything from that framework, it doesn't complain, but as soon as I try to use it and compile I get the errors shown in the image below.
(even with a simple declaration like this)
var folder = JWFolders()
So, If anyone was wondering, I got it working. I contacted the developer and asked for help, and he nicely told me I was forgetting to add the source code files ".m" to the source compiling files.
After that it worked.
After I installed the latest version of xcode i'm having a very annoying issue.
While I'm coding, xcode goes nuts. Without me doing anything weird, just typing code, xcode stop recognizing classes.
For example: I want to add UITableViewDelegate to my class, but it doesnt recognize it. After i type it manually sometimes it recognize it and it is shown in purple, some other time it doesnt. But both times it won't really consider it, so if I try to write down a method of that delegate, it won't show it.
Other times if I try to call a variable of a certain class, while trying to autocompleting it, it shows <>.
Other times if I try to call any class, let's say I try to type var test = UIActionSheet, it just shows a few elements in the autocomplete list (raw types, primitives, the classes of my main project, but it doesn't show the majority of classes).
It's like it's missing the documentation and the link with the main frameworks...
I'm working on a simple tabbed app from yesterday and it's the 3rd time i started all over because of this issue, thinking that starting over would fix the issue, but it's not working.
If i open a different project while the issue is going on, the other project works ( but i recoded all over my app so it's not that one the issue, and i also have the same issue on other project... it just doesn't affect 2 project at the same time )
i tried deleting derived data
i tried restarting both xcode and the comp
What's going on?
Here are two screenshoots where you can see what's happening:
I had the same problem earlier.
Exit Xcode and delete Derived Data folder here ~/Library/Developer/Xcode
Restart Xcode and you should see the autocomplete working again.
You have to learn how to take it apart and put back together.
Either reinstall Xcode, if it doesn't help, create a new project.
Then copy source files one by one and see when it breaks.
Freshly install the XCode IDE version 6.1
Use CMD + F to find all _element.
Check that if you named one variable _element
The following code may reproduce the error:
class _element:NSObject {
}
let _element:UIImage = UIImage()
// type _element under this line
I'm new to Objective C and (unfortunately) also to the project I am working on. I was given a small sample project that refers to work from my predecessors (in C++) and uses it for an iPhone app (Objective C). Rather than extending the sample (it was quick n dirty and I didn't wanna mess around in it) I created a new project from scratch for my stuff. To get it working I need to set up the same links to the previous libraries as the other one, but although in my settings I can't find any differences to the existing project it won't do the trick.
With the help of colleagues and Google I reached this:
1) The project includes two library files, libyid.a and libvrpn.a, via Xcode's "Add files" dialogue. It automatically added the libraries' paths to the Library Search Paths in the Build Settings and the files show in the projects folder structure in XCode.
As far as I can tell this bit seems not to cause problems.
Edit: if i remove these files from the project I get the same errors. I'm now thinking that XCode can resolve the headers, but can't find the implementation and that the libraries may have been there but not been properly set up?
2) One of my custom classes uses
#import "DisplayYid.h"
I added the path to the file's location to the "Header Search Paths" in the Build Settings and it seems to be found alright. (I also added the file via the "Add files" dialogue at some point, but it didn't change anything, so I left it this way)
Now the problem: in
#interface YidController : NSObject {
DisplayYid *myYid;
// (etc. etc.)
}
the identifier "DisplayYid" seems to remain unknown (Error: Expected specifier-qualifier-list before DisplayYid). In addition, all the class definitions in the headers that DisplayYid itself includes yield
error: expected '=', ',', ';', 'asm' or '__attribute__' before '__declspec'
My knowledge here is unfortunately very limited, but it seems to me that XCode can find the headers in question, but somehow would expect the content in a different format/language?
When I had DisplayYid.h included as a file in the project hierarchy I tried to set its file type in the file inspector to "C++ header" (as suggested by some hits I found on Google for my problem), but this doesn't change a thing.
I feel I am missing some tiny but crucial detail, but am not sure-footed enough in any of this to test around further. Hopefully somebody sees my missing link? And sorry if this is too lengthy, I simply tried to include the detailed steps in case this is were the problem lies.
Thanks in advance for your time ;)
EDIT: This question seems to be the same problem, especially the fact that he gets the error multiple times from files simply copied. But none of the suggested solutions seem to work for me.
It's been a while now, but I got hold of the guy who worked on this previously. It took him an hour, but he found the missing bit: In the project settings, two compiler flags needed to be set:
-DIOS (defining the flag iOS)
-x objective-c++
From there on everything went fine. Since this was a rather project-related question and solution, should I delete it all together?