Swift lazy property called twice via init(coder:)

Originator:jesse.d.squires
Number:rdar://22302280 Date Originated:16 Aug 2015
Status:Open Resolved:
Product:Developer Tools Product Version:7.0 beta 5 (7A176x)
Classification:Serious Bug Reproducible:Always
 
Summary:
In Swift, initializing a lazy var from init(coder:) initializes the lazy var twice.

Search attached project for "FIXME:" comment.

Demo project also available at https://github.com/jessesquires/JSQWebViewController

Steps to Reproduce:
1. Build and run the attached demo project
2. Tap "Push" -- note that VC pushes on navigation stack normally
3. Tap "Modal" -- note that modal VC presents normally
4. Tap "Storyboard" -- this pushes the VC via storyboards (should crash)
5. Note the console log messages for each case
6. When pushing the VC via storyboards -- i.e., initializing via init(coder:) -- the lazy property "_webView" is called twice
7. Note the crash

Expected Results:
A lazy property should only ever be initialized once

Actual Results:
The lazy _webView property is initialized more than once when the ViewController is initialized via init(coder:)

Version:
Xcode 6 and 7.

Latest confirmed: Version 7.0 beta 5 (7A176x)

Notes:


Configuration:


Attachments:
'JSQWebViewController.zip' was successfully uploaded.

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!