TechBee
TechBee

Reputation: 1941

How to create global enum

How to access enum through all classes. Let me explain:

enum
{
   BottomBackButtonNav = 0,
   BottomNextButtonNav,
   BottomSliderIncreaseNav,
   BottomSliderDcreaseNav,
   PageSwipeLeftNav,
   PageSwipeRightNav,
   NavFromThumbnailView,
   NavFromTOCView,
} NavigationType;

This enum is defined in my MainViewController's header and want to use it to all my views. How to do this, please guide.

Regards.

Upvotes: 9

Views: 7864

Answers (2)

John Riselvato
John Riselvato

Reputation: 12924

You can also create a header file that holds all your enums and then import this header file in your projects .pch file (usually located in your Supporting Files folder).


This Prefix header uses the contents of this file and includes them on every source file. So it pretty much imports whatever headers that are set in the #ifdef __OBJC__ section to every file during compile time.

Upvotes: 10

rano
rano

Reputation: 5666

You can define it in an header file (.h) and import it in each module you need

Upvotes: 18

Related Questions