[swift-users] Printing Enums?

Michael Rogers mprogers at mac.com
Mon Jul 17 17:15:03 CDT 2017

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

// 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.


Dr. Michael P. Rogers
Associate Professor, Northwest Missouri State University
Tinkerer-in-Chief and Angel Flight Pilot
Twitter & Google+:  mprogers at mac.com;  Skype: 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 😀

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170717/3a0664d7/attachment.html>

More information about the swift-users mailing list