> On Jun 19, 2017, at 3:37 PM, Charles Srstka <cocoa...@charlessoft.com> wrote: > >> On Jun 19, 2017, at 4:29 PM, Alex Zavatone <z...@mac.com> wrote: >> >> From line 153 of UIViewController.h: >> >> As a convenience, the default init method will do this for you, >> and specify nil for both of this methods arguments.) In the specified NIB, >> the File's Owner proxy should >> have its class set to your view controller subclass, with the view outlet >> connected to the main view. If you >> invoke this method with a nil nib name, then this class' -loadView method >> will attempt to load a NIB whose >> name is the same as your view controller's class. >> >> The pearl is here: >> >> If you >> invoke this method with a nil nib name, then this class' -loadView method >> will attempt to load a NIB whose >> name is the same as your view controller's class. > > The documentation begs to differ, though:
AppKit vs UIKit – your both right for the respective frameworks you are speaking to. > > https://developer.apple.com/documentation/appkit/nsviewcontroller/1434405-loadview > >> Prior to OS X v10.10, the loadView() method did not provide well-defined >> behavior if the nibName property’s value was nil. In macOS 10.10 and later, >> however, you get correct behavior without specifying a nib name as long as >> the nib file’s name is the same as that of the view controller. For example, >> if you have a view controller subclass called MyViewController and a nib >> file with the same name, you can employ the convenient initialization >> pattern [[MyViewController alloc] init]. > > The AppKit release notes agree: > > https://developer.apple.com/library/content/releasenotes/AppKit/RN-AppKitOlderNotes/index.html#10_10ViewController > >> loadView: would previously not have well defined behavior if there was a >> "nil" nibName. On 10.10 and later, if nibName is nil NSViewController will >> automatically try to load a nib with the same name as the classname. This >> allows a convenience of doing [[MyViewController alloc] init] (which has a >> nil nibName) and having it automatically load a nib with the name >> "MyViewController”. > > The sense I get from these methods is that it might have kinda, sorta, > accidentally worked in the past, but it shouldn’t be relied on. > > Reading through those release notes reminded me of *another* caveat I’d > forgotten; the functionality only correctly parses Swift class names in > *10.11* and higher. Otherwise, it’ll be looking for MyProjectName.Foo.xib > instead of Foo.xib like it should. So, if you’re using Swift, better to > restrict usage of this feature to El Cap or better. > > Charles > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com > > This email sent to david.dun...@apple.com -- David Duncan _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com