Swift: The method initWithNibName:bundle will always be inlined/vtabled in release mode
| Originator: | jasper.reloaded | ||
| Number: | rdar://21177388 | Date Originated: | 6/1/2015 |
| Status: | Open | Resolved: | |
| Product: | Xcode | Product Version: | 6.3.2 (6D2105) |
| Classification: | Serious Bug | Reproducible: | Always |
Summary:
In Swift, the method initWithNibName:bundle will always be inlined or vtabled in release mode, even if a UIViewController overrides this method and applies the `dynamic` attribute.
This prevents dynamic invocation of this method via the Objective-C runtime.
Steps to Reproduce:
1. Clone the Typhoon-Swift-Example project: https://github.com/appsquickly/Typhoon-Swift-Example
2. In ApplicationAssembly.swift uncomment lines 118 to 123 ( definition.useInitializer("initWithNibName:bundle:") )
3. Run the project in RELEASE mode
4. Add a new city for a weather report
Expected Results:
initWithNibName:bundle can be invoked dynamically via the Objective-C runtime.
Actual Results:
In release mode, initWithNibName:bundle can NOT be invoked dynamically via the Objective-C runtime, even if a sub-class of UIViewController overrides this method and applies the dynamic attribute.
Version:
RELEASE config, Swift 1.2, Xcode Version 6.3.2 (6D2105)
Notes:
Configuration:
RELEASE config, Swift 1.2, Xcode Version 6.3.2 (6D2105)
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!