Video Tutorial: Objective-C Data Types: Enum & Bitmask

Learn how to add enumeration and bitmask types in Objective-C, using the new NS_ENUM and NS_OPTIONS keywords. By Ray Wenderlich.

Leave a rating/review
Save for later
Share

Contents

Hide contents

Video Tutorial: Objective-C Data Types: Enum & Bitmask

0 mins

Challenge

Your challenge is to replace the NS_ENUM with the old-style way of doing things:

enum tag_VideoGameType {
    VideoGameTypeRPG,
    VideoGameTypeStrategy,
    VideoGameTypeAction,
    VideoGameTypeFPS
};
typedef int VideoGameType;

Then delete the default condition in your case statement. What advantage of NS_ENUM does this show you?

Download solution

Helpful links

Errata

  • When discussing the bitwise-or operator (|), I misspoke and called it the OR operator (||).
  • I said that you use the command-I key to indent code, but actually it is control-I.

Contributors

Over 300 content creators. Join our team.