Xcode rebuilding constantly after implementing a class - ios

I recently used this "iOS Color Picker" (the top response) from StackOverflow into my project. It's absolutely fantastic, and draws straight into Interface Builder - however, it also seems to cause Xcode to rebuild constantly.
As soon as I type one single character, Xcode rebuilds the entire project and it's getting incredibly tedious. All the information I could find on the matter tells me to turn off "Live Issues" under the Xcode prefs - but as a relative beginner to coding, I rely heavily on being able to see errors as they appear.
My question is: is there any way to turn off this constant rebuilding WITHOUT disabling "live issues"? (either by altering the iOS Color Picker code, or some other option in Xcode itself?)
Thanks!

It is caused by the IB_DESIGNABLE definitions in the source header files. Probably it makes problem only if the header file containing IB_DESIGNABLE is included (even implicitly) to the source file you are currently editing.
I did not find a definitive solution how to disable IB_DESIGNABLE and thus compiling the storyboard and the source files continuously. I would appreciate an Xcode flag to disable this temporarily. I tried also surrounding the IB_DESIGNABLE with #ifdef macros but they are considered even if the #ifdef evaluates to false. Commenting out one by one the IB_DESIGNABLE helps but it is not a feasible solution with many IB_DESIGNABLEs.
Update
I finally found a quick way to avoid this annoying behavior. Having the storyboard opened in the active window, disable "Automatically Refresh Views" from the Editor menu. This will stop updating the views in the storyboard editor that use your custom code and thus speed up your development significantly. When you need again the just-in-time compiling to have a visual preview of your custom code, enable this option again (it seems you also have to re-open your storyboard to make it working again).
You may wish to add a key binding to the command, such as command-option-control-A, to easily toggle the behavior on/off. To add a key binding in Xcode, touch command-comma for preferences, choose the Key Bindings tab, use the search bar to find the command, then double-click on the right area to add your desired keystroke.
"Leave it off" approach
Alternately turn "Automatically Refresh Views" off, and never turn it on.
Make a convenient keystroke for "Refresh all views", say command-option-shift-R
As you work, just touch command-option-shift-R from time to time, or as needed. It's generally only necessary to touch command-option-shift-R as you work on the storyboard.

Related

GLKView in IB will cause crash when app is run without Xcode

I have an app that displays a ViewController at some point, which includes a GLKView. All defined within a storyboard.
It works just fine, that is, unless you run the app from the phone itself, not launched from within Xcode. Upon presentation of the ViewController and therefore the GLKView, the app instantly crashes.
It doesn't matter if the Installed checkbox is ticked or unticked for the GLKView. Only when I delete it from the storyboard altogether, it won't crash.
Any ideas?
I don't know why these things happen but I would consider them a bug. A similar situation happens when adding a WKWebView directly from storyboard. For both the solution is pretty simple: All you need to do is import the module for it. So in your case in your view controller add:
import GLKit
It seems otherwise the framework is not loaded or something.
With ObjectiveC the problem seems to go a level deeper. It seems that the module must manually be imported. Go to your project settings. Select your target. Select "General". Scroll down to bottom and find "Linked Frameworks and Libraries". Below it find a "+" button and search for "GLKit.framework" and add it. This should fix the issue.

Xcode not allowing me to see full target names

My Xcode is acting weird like this:
For some reason I cannot seem to expand the Targets and Project tab so I cannot see which target is which.
Why is this question being down voted so much without a single comment
? I already tried moving the slider/divider to the right.
It's a bug: every once in a while, the column of project and target names gets "wedged" in this position.
But the workaround is pretty easy: make the window wider / narrow until the expander widget starts working again. You might also have to switch out of target editing mode to the code editor and come back again. Basically you're just trying to slap the target editor on the side of the head.

Xcode keeps building storyboard after each keystroke

My Xcode project using a storyboard entered in a very weird state recently: Xcode keeps building the whole project and notably the storyboard after each keypress. I found no reason for this behavior neither in my project diffing all interesting files (storyboard and project) neither a setting in Xcode (maybe I just could not find it?) Needless to say that this "feature" makes working on my project nearly impossible since the CPU is constantly occupying with rebuilding the storyboard when I type new code. Anybody seen this?
It is caused by the IB_DESIGNABLE definitions in the source header files. Probably it makes problem only if the header file containing IB_DESIGNABLE is included (even implicitly) to the source file you are currently editing.
I did not find a definitive solution how to disable IB_DESIGNABLE and thus compiling the storyboard and the source files continuously. I would appreciate an Xcode flag to disable this temporarily. I tried also surrounding the IB_DESIGNABLE with #ifdef macros but they are considered even if the #ifdef evaluates to false. Commenting out one by one the IB_DESIGNABLE helps but it is not a feasible solution with many IB_DESIGNABLEs.
Update
I finally found a quick way to avoid this annoying behavior. Having the storyboard opened in the active window, disable "Automatically Refresh Views" from the Editor menu. This will stop updating the views in the storyboard editor that use your custom code and thus speed up your development significantly. When you need again the just-in-time compiling to have a visual preview of your custom code, enable this option again (it seems you also have to re-open your storyboard to make it working again).
You may wish to add a key binding to the command, such as command-option-control-A, to easily toggle the behavior on/off. To add a key binding in Xcode, touch command-comma for preferences, choose the Key Bindings tab, use the search bar to find the command, then double-click on the right area to add your desired keystroke.
"Leave it off" approach
Alternately turn "Automatically Refresh Views" off, and never turn it on.
Make a convenient keystroke for "Refresh all views", say command-option-shift-R
As you work, just touch command-option-shift-R from time to time, or as needed. It's generally only necessary to touch command-option-shift-R as you work on the storyboard.
I had this problem and the accepted answer did not work for me.
The problem I had was that I always keep the storyboard open in it's own tab within XCode so that I can access it quickly.
The only way I could fix it was to either close that tab or select a different file (like a normal code file) and then close and reopen XCode. Thereafter it was no longer rebuilding on each keystroke.
Be warned however if you need to open the storyboard to make changes then this problem can sometimes reappear and I will have to repeat the above process.
Can't wait till Apple fixes this as it is very frustrating indeed!
(ノಠ益ಠ)ノ彡┻━┻

Nib view in Xcode Interface builder does not apply autolayout constraints

I have a Nib view that my coworker has created with working autolayout constraints. When he resizes the view in interface builder the constraints are applied and the view is shown correctly.
When I do the same thing on my computer the constraints are not applied. We have compared the settings and view options but we can't see any differences.
The feature is called "live autoresizing" and its failure may be a bug. See this question where other people had a similar problem. In fact, just now it was working for me, but when I turned it off and on again in the Editor menu, it no longer did, even after restarting.
Setting up a keyboard shortcut for Update Frames in the Xcode preferences -> key bindings could help speed things up a lot. In my case I found it listed twice and one of them had a shortcut already assigned, but it didn't work. Ah, Xcode.
You can go to bugreport.apple.com and file a radar, but if you're going to do that see this page first.
Check if use autolayout and use size classes is enabled in the file inpector in the .xib file.

Source control xCode 6 and existing files

I have a project in xCode 6 using Swift (my very first experience developing iOS Apps).
I was having problems with gestures (they are alive even after removing them from storyboard) and decide to delete the ViewController I was having problem. The program compiled as it still exists. Then I decide to delete and remove reference to file main.storyboard and everything works just as before.
I believe that is related to source control
Where are those view controllers and even the storyboard stored?
By using the storyboard, sometimes you are creating some link between your elements and/or some part of your code.
These links will still be, even after deleting the element unless you delete the link itself.
In order to perform good deletion, you should first right click on the element you want to delete and suppress all its links. Then you can safely delete your element:

Resources