using 720p, 1080p as enum in swift -


i want use 720p, 1080p enums in swift. however, can't. got error saying "expected digit after integer literal prefix"

enum asresolution {     case lowresolution     case 720p     case 1080p     caee highresolution } 

what should do?

i revised code below:

enum asresolution:int {     case low = 1     case hd = 720     case fullhd = 1080     case high = 2000 } 

there isn't can if want keep names. enum case identifier, , can see language reference there restrictions can use first character.

so, pretty can't start variable name digit (they identifiers well), can't start enum case digit.

the few options have are:

  • prefix identifier permitted character (such underscore)
  • completely change identifier, using words (seventwozerop , onezeroeightzerop) or synonyms (hdready , fullhd)

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -