Xcode 7.1 missing class template methods on El Capitan - xcode

MacBook Pro (Retina, 15-inch, Mid 2015)
El Capitan 10.11.1
Xcode 7.1 (7B91b)
When I do File > New > File, Subclass of: UICollectionViewController, I get an implementation file containing only:
#import "CVCTest.h"
#implementation CVCTest
#end
So, there are none of the UICollectionViewDataSource and UICollectionViewDelegate method stubs I expect. This is true for new UITableViewController and UIViewController subclass files as well.
This seems to be a suddenly new phenomenon; I created a UICollectionViewController subclass in a project last week which came with the stubbed methods. Xcode seems to have lost the class file templates.
After deleting the Xcode app and the ~/Library/Developer/Xcode directory, rebooting, and installing Xcode 7.1 from Mac AppStore, the behavior is the same.
I checked with on colleague whose Xcode behaves this way and then with another whose Xcode behaves as expected.
Anyone else experiencing this? Any clue what might be causing this?

Ok. A critical piece of information I left out of my question is that I was subclassing a controller class for an iOS project. The "o.m.g" answer is that somehow
OS X source
was selected at the bottom of the left pane of the source type selection view, instead of
iOS source
With iOS source selected, I get the class template file with the expected stubbed methods.
wow.

Related

Main storyboard changed after being required 8.0. Now more than 100 mistakes in the project

I had the same problem as this on Xcode
The document Main.storyboard requires Xcode 8.0 or later
Despite that I have never tried to update my Xcode or tried to open any project in an other version of Xcode. I am currently using the beta 7.2
I had done this solution:
As I couldn't open the interface builder. So now I can finally open my storyboard but I have 144 mistakes in my project that I didn't have yesterday.
I updated my question with some of the mistakes I have now on my code. These are the big problem as I don't know how to fix it because it was ok the day before.
So I have for my picker view the following code:
class ABViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate {
And the error says: Type "ABViewController" does not conform to protocol 'UIPickerViewDataSource'
Any solutions?
Thx

Xcode storyboard showing osX object library. I want IOS object library

I develop mainly IOS apps but, recently, I worked on an OSX app. Both are possible with Xcode (I use 8, with swift).
Unfortunately, when I switched back to my already-existing IOS project (after restarting Xcode), the storyboard selection menu for the object library shows only OSX objects, not IOS (e.g. UIImageView).
I have googled without success and tried restarting Xcode, also without success. Can anyone help me fix this?
I did a lot more searching and came up with:
Xcode is loading in OS X objects instead of iOS objects
There there are other solutions proposed but the one that worked for me was to close the assistant editor and then, in the file list ( leftmost window in Xcode 8), I double clicked on the storyboard file. Problem solved. I am surprised that this bug still exists in this latest version...it is very troublesome.

Xcode 8.1 missing Object Library

I have an android background, but am just learning how to build iPhone apps using swift. I am using the book Beginning iPhone Development with Swift 2: Exploring the iOS SDK.
Problem is that it refers to Buttons and such being in the Object Library and I don't have anything in my object library. I have clicked on the View as instructed.
I have a newly installed MacBook and am running Xcode 8.1, which is newer than the book's directions. It refers to iOS UIkit, but I don't know how to install this.
I did Single View Application under iPhone to get where I am. Can anyone point me to what I need to do? I am brand new to the Apple world entirely.
Aha! In the main window, I clicked on the storyboard and that allowed the Object Library to contain the view items, including buttons.
So, click on the storyboard in the main window, then click on the view in the IB.

SCNParticleSystem subclass with custom property causes crash

If I subclass SCNParticleSystem and add a property to the custom subclass, and assign a value to the property. SceneKit will crash on Mac. But it works on iOS and tvOS!
The crash always occurs when the particle systems emitter shape is being assigned a SCNNode geometry!
Its that: EXC_BAD_ACCESS (code=1...)
See the screenshots & test my simple example project.
I don’t understand why this is crashing, is there a workaround? How can I add custom properties to a SCNParticleSystem otherwise?
Xcode 7.2
Xcode 7.3 beta (7D111g)
Mac OS X 10.11.3 (15D21)
Example Project

NSPopover sample code does not detach window

I have not been able to get my NSPopover to detach to a window in my own projects, so to simplify I tried the Apple sample.
I downloaded a fresh copy of the Apple sample project: http://developer.apple.com/library/mac/samplecode/Popover/Introduction/Intro.html
It behaves the same, which is to say I can't drag the window to detach it either.
The project seems to provide all the correct windows and controllers and implements the detachableWindowForPopover: delegate method. However the method is never called.
Does anyone know the secret to detachable NSPopovers?
Found the answer while typing the question…
Mac OS X 10.10 Yosemite has a new delegate method:
(BOOL)popoverShouldDetach:(NSPopover *)popover
The default behavior on Yosemite is NO (should not detach). So delegates must implement this method in order for windows to be detachable. The sample project does not implement this method, so when compiled on Yosemite it will not detach (and also produces several deprecation warnings -- maybe I should have taken that hint that it needs an update).
Adding:
- (BOOL)popoverShouldDetach:(NSPopover *)popover {
return YES;
}
To MyWindowController.m fixes the problem.

Resources