I’ve found a bug in Swift’s loadView for UIViewController on iOS that I’d like 
to report.  Swift.org tells us to use https://bugreport.apple.com which returns 
 “bugreport.apple.com’s server IP address could not be found.”.

Feedback.apple.com seems not related to bug reporting.  

I’ve created two projects that show expected behaviour for loadView in 
UIViewController, and how in Swift, what is indicated in the header for 
loadView is not followed.

How can I report this to Apple or the Swift team?

Essentially, what this header information is telling us is not followed in 
Swift 5.x, breaking over 13 years of precident.  Swift does not attempt to load 
an XIB that matches the name of the class being instantiated if the view is 
nil, counter to what the header file says it should do.

From  UIViewController.h

    /*
      The designated initializer. If you subclass UIViewController, you must 
call the super implementation of this
      method, even if you aren't using a NIB.  (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. If no such NIB in fact 
exists then you must either call
      -setView: before -view is invoked, or override the -loadView method to 
set up your views programatically.
    */



The behaviour below is what is simply not happening.

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 easyiest way to reproduce this is to simply create a ViewController with an 
XIB and make it the initial view controller in a storyboard.  
Add a label to the XIB to make it obvious when or if the XIB loads.  
In the storyboard scene for that viewController, delete the top level view to 
create the nil condition and run the app.

In an Objective-C app on iOS, the expected XIB loads.
In a Swift app on iOS, the view is empty and no XIB loads.

This is validated in the View Debugger.

So, how can I report this?

Thanks in advance.
Alex Zavatone


_______________________________________________

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

Reply via email to