If I create and print the contents of a simple enum it works as I would expect:
That prints out "state is loaded".
But this statement doesn't work as I would expect:
That prints out "self.traitCollection.userInterfaceIdiom is UIUserInterfaceIdiom". I'm confused why it isn't printing "phone", which it actually is set to. If I checked if "self.traitCollection.userInterfaceIdiom == .phone" that returns true. userInterfaceIdiom is defined as a UIUserInterfaceIdiom, which is an enum. So why is it printing "UIUserInterfaceIdiom" instead of "phone"?
enum State : Int {
case noData
case loaded
}
state = .loaded
print("state is \(state)")
case noData
case loaded
}
state = .loaded
print("state is \(state)")
That prints out "state is loaded".
But this statement doesn't work as I would expect:
print("self.traitCollection.userInterfaceIdiom is \(self.traitCollection.userInterfaceIdiom)")
That prints out "self.traitCollection.userInterfaceIdiom is UIUserInterfaceIdiom". I'm confused why it isn't printing "phone", which it actually is set to. If I checked if "self.traitCollection.userInterfaceIdiom == .phone" that returns true. userInterfaceIdiom is defined as a UIUserInterfaceIdiom, which is an enum. So why is it printing "UIUserInterfaceIdiom" instead of "phone"?