Last active
February 21, 2017 08:54
-
-
Save yamazaki-sensei/cb0dbefe5df1658bb7370fd592a45a1d to your computer and use it in GitHub Desktop.
ちゃんとNS_ENUMを使おう、という話 ref: http://qiita.com/almichest/items/9ce71a55023027e12a0a
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import <Foundation/Foundation.h> | |
| typedef enum : NSInteger { | |
| EnumHogeType1, | |
| EnumHogeType2, | |
| } EnumHoge; | |
| typedef NS_ENUM(NSInteger, EnumFuga) { | |
| EnumFugaType1, | |
| EnumFugaType2 | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let hoge: EnumHoge = EnumHogeType1 // .type1とは書けない | |
| let fuga: EnumFuga = .type1 // 逆に、EnumFugaType1 とは書けない |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment