Skip to content

Commit 709704c

Browse files
authored
Merge pull request #195 from felipowsky/swift
Better Swift enum compatibility.
2 parents dcadd6d + c0a395f commit 709704c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

HMSegmentedControl/HMSegmentedControl.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313
typedef void (^IndexChangeBlock)(NSInteger index);
1414
typedef NSAttributedString *(^HMTitleFormatterBlock)(HMSegmentedControl *segmentedControl, NSString *title, NSUInteger index, BOOL selected);
1515

16-
typedef enum {
16+
typedef NS_ENUM(NSInteger, HMSegmentedControlSelectionStyle) {
1717
HMSegmentedControlSelectionStyleTextWidthStripe, // Indicator width will only be as big as the text width
1818
HMSegmentedControlSelectionStyleFullWidthStripe, // Indicator width will fill the whole segment
1919
HMSegmentedControlSelectionStyleBox, // A rectangle that covers the whole segment
2020
HMSegmentedControlSelectionStyleArrow // An arrow in the middle of the segment pointing up or down depending on `HMSegmentedControlSelectionIndicatorLocation`
21-
} HMSegmentedControlSelectionStyle;
21+
};
2222

23-
typedef enum {
23+
typedef NS_ENUM(NSInteger, HMSegmentedControlSelectionIndicatorLocation) {
2424
HMSegmentedControlSelectionIndicatorLocationUp,
2525
HMSegmentedControlSelectionIndicatorLocationDown,
2626
HMSegmentedControlSelectionIndicatorLocationNone // No selection indicator
27-
} HMSegmentedControlSelectionIndicatorLocation;
27+
};
2828

29-
typedef enum {
29+
typedef NS_ENUM(NSInteger, HMSegmentedControlSegmentWidthStyle) {
3030
HMSegmentedControlSegmentWidthStyleFixed, // Segment width is fixed
3131
HMSegmentedControlSegmentWidthStyleDynamic, // Segment width will only be as big as the text width (including inset)
32-
} HMSegmentedControlSegmentWidthStyle;
32+
};
3333

3434
typedef NS_OPTIONS(NSInteger, HMSegmentedControlBorderType) {
3535
HMSegmentedControlBorderTypeNone = 0,
@@ -43,11 +43,11 @@ enum {
4343
HMSegmentedControlNoSegment = -1 // Segment index for no selected segment
4444
};
4545

46-
typedef enum {
46+
typedef NS_ENUM(NSInteger, HMSegmentedControlType) {
4747
HMSegmentedControlTypeText,
4848
HMSegmentedControlTypeImages,
4949
HMSegmentedControlTypeTextImages
50-
} HMSegmentedControlType;
50+
};
5151

5252
@interface HMSegmentedControl : UIControl
5353

0 commit comments

Comments
 (0)