UIKit: NSStringDrawingOptions is incorrectly translated into Swift

Originator:adrian.kashivskyy
Number:rdar://17201627 Date Originated:06-Jun-2014 07:41 PM
Status:Closed Resolved:Yes
Product:iOS SDK Product Version:iOS 8.0 SDK Beta 1 (12A4265u)
Classification:Other Bug Reproducible:Always
 
Summary:
Structures which are "enum NS_OPTIONS(XYZ, NSInteger)" in Objective-C are translated into Swift as "struct XYZ : RawOptionSet", so they support bitwise operations. NSStringDrawingOptions doesn't.

Steps to Reproduce:
1. Create a " project in Xcode
2. Create a playground with "import UIKit" declaration
3. Type "let xyz : NSStringDrawingOptions = .UsesLineFragmentOrigin | .UsesFontLeading"
4. Enjoy the error

Expected Results:
No error, NSStringDrawingOptions declared as:

struct NSStringDrawingOptions : RawOptionSet

Actual Results:
Compiler error, NSStringDrawingOptions declared as:

enum NSStringDrawingOptions : Int

Version:
iOS 8.0 SDK (12A4265u)

Notes:
This problem occurs only in iOS SDK. NSStringDrawingOptions in Cocoa version of Foundation.framework is declared as expected. Demo.xcodeproj is in the attachment.

Configuration:
Xcode 6.0 (6A215l) +  OS X 10.9.3 (13D65) running on MacPro5,1

Attachments:
'Demo.zip' was successfully uploaded.

--- 06-Jun-2014 07:43 PM

You can refer to this StackOverflow question, if needed: http://stackoverflow.com/questions/24064650/how-to-pass-multiple-enum-values-as-a-function-parameter/24065414

--- 05-Aug-2014 09:43 PM

Issue is still reproducible in iOS 8 Beta 5 SDK (12A4345d).

--- 11-Feb-2015 01:58 PM

This issue has been fixed in iOS 8.3 Beta 1 SDK (12F5027d) and can be closed.

--- 11-Feb-2015 01:59 PM

This issue has been verified as resolved and can be closed.

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!