Certain Objective-C enums don’t print a useful debug description. I 
usually work around this by implementing CustomStringConvertible (or the debug 
version) for the type myself. You probably want to file a bug with Apple.


Jon


> On Jul 17, 2017, at 6:15 PM, Michael Rogers via swift-users 
> <swift-users@swift.org> wrote:
> 
> Hi, All:
> 
> Can someone please enlighten me as to why the first enum works as expected, 
> giving me Melbourne, but the second gives UIModalPresentationStyle rather 
> than fullScreen? 
> 
> 
> enum City {
>     case Melbourne, Chelyabinsk, Bursa
> }
> let city = City.Bursa
> 
> print(city)
> // prints "Melbourne"
> 
> let cityName = "\(city)"   // or `let cityName = String(city)`
> // cityName contains "Melbourne"
> 
> // Why doesn't the following work?
> 
> let presStyle = UIModalPresentationStyle.fullScreen
> 
> print(presStyle) // prints UIModalPresentationStyle
> 
> let presStyleName = "\(presStyle)"
> 
> 
> I have an ugly work-around using String UIPresentationStyle tuples, but I'd 
> rather not use it if possible.
> 
> Thanks,
> 
> Michael
> ---------------------------------------------------------------------------
> Dr. Michael P. Rogers
> Associate Professor, Northwest Missouri State University
> Tinkerer-in-Chief and Angel Flight Pilot
> Twitter & Google+:  mprog...@mac.com <mailto:mprog...@mac.com>;  Skype: 
> mprogersatmac.com <http://mprogersatmac.com/>; Facebook: mprogers
> Phone:  309-825-6454 (H);  660-562-1551 (W)
> 
> Thank you, thank you, thank you, and I'd like to thank all the little people 
> -- Tom Thumb, Ant-Man, and, of course, all the Lilliputians -- who made this 
> award possible 😀
> 
> _______________________________________________
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to