Swift: Allow extensions to contain stored properties (partially)

Originator:adrian.kashivskyy
Number:rdar://18073667 Date Originated:20-Aug-2014 12:12 PM
Status:Dupe/11437733/Closed Resolved:Yes
Product:Developer Tools Product Version:Xcode 6.0 Beta 6 (6A280e)
Classification:Enhancement Reproducible:Not Applicable
 
Summary:
Swift documentation encourages to declare protocol conformance using extensions, but implementation of more sophisticated protocols sometimes requires a presence of stored properties.

In Objective-C, I would divide my implementation into chunks using the "class extension" concept, as long as they're in the same source file as the main implementation:

    @interface Foo ()
    @property NSString *baz;
    @end

In Swift, however, this is not possible:

    extension Foo {
        var baz: String?
    }

Allowing this would be a very welcome addition, even with restrictions (i.e. this kind of extension would have to be declared within the same target).

Steps to Reproduce:
n/a

Expected Results:
n/a

Actual Results:
n/a

Version:
Feature is not yet available as of Xcode 6.0 Beta 6 (6A280e)

Notes:
n/a

Configuration:
n/a

Attachments:

--- 23-Aug-2014 01:08 AM / ADR

Engineering has determined that your bug report is a duplicate of another issue and will be closed.

11437733

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!