> On Dec 15, 2016, at 7:28 AM, Charles Srstka via swift-evolution 
> <[email protected]> wrote:
> 
>> On Dec 15, 2016, at 12:16 AM, Derrick Ho <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> You can currently access swift enums from objective c provided that it is 
>> marked @objc and inherits from Int.
> 
> Not when I try it:
> 
> enum MyEnum: Int {

The @objc annotation needs to be here.

@objc enum MyEnum: Int { ... }

You can then freely do even this:

@NSManaged var enumValue: MyEnum

and it works just fine with CoreData...

>     case foo = 0
>     case bar = 1
> }
>     
> @objc var myEnum: MyEnum = .foo // Property cannot be marked @objc because 
> its type cannot be represented in Objective-C
> 
> Charles
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to