UIViewController() is causing the properties to be initialized

Originator:marcvanolmen
Number:rdar://19730160 Date Originated:2/5/2015
Status:Resolved Resolved:4/5/2015
Product:iOS SDK Product Version:8.1
Classification:Bug Reproducible:Always
 
Sample project at:

https://github.com/marcvanolmen/TestViewControllerDoubleInit

Summary:
Run the sample app and you will notice that when you call
        
        // This logs "property init was called" 2x
        NSLog("create MyOtherViewController with init()")
        var aTest = MyOtherViewController()

        // This logs "property init was called" 1x
        NSLog("create MyOtherViewController with init(nibName: bundle:)")
        var aTest2 = MyOtherViewController(nibName:nil, bundle: nil)

Steps to Reproduce:
class MyDebugPrint : NSObject {
    
    override init() {
        NSLog("property init was called")
        super.init()
    }
}


class MyOtherViewController: UIViewController {
    
    private let aProperty = MyDebugPrint()


1. var aTest = MyOtherViewController()
2. This will call it the aProperty init of the variables. 2x


Expected Results:
That init of MyDebugPrint class gets called once.

Actual Results:
That init of MyDebugPrint class gets called twice.

Version:
8.1.1 build Xcode 6.1.1

Notes:


Configuration:
iOS SDK in simulator also iPHone 6 with iOS 8.1.3

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!