Skip to content

Commit

Permalink
Merge pull request #195 from felipowsky/swift
Browse files Browse the repository at this point in the history
Better Swift enum compatibility.
  • Loading branch information
HeshamMegid authored Aug 29, 2016
2 parents dcadd6d + c0a395f commit 709704c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions HMSegmentedControl/HMSegmentedControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@
typedef void (^IndexChangeBlock)(NSInteger index);
typedef NSAttributedString *(^HMTitleFormatterBlock)(HMSegmentedControl *segmentedControl, NSString *title, NSUInteger index, BOOL selected);

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

typedef enum {
typedef NS_ENUM(NSInteger, HMSegmentedControlSelectionIndicatorLocation) {
HMSegmentedControlSelectionIndicatorLocationUp,
HMSegmentedControlSelectionIndicatorLocationDown,
HMSegmentedControlSelectionIndicatorLocationNone // No selection indicator
} HMSegmentedControlSelectionIndicatorLocation;
};

typedef enum {
typedef NS_ENUM(NSInteger, HMSegmentedControlSegmentWidthStyle) {
HMSegmentedControlSegmentWidthStyleFixed, // Segment width is fixed
HMSegmentedControlSegmentWidthStyleDynamic, // Segment width will only be as big as the text width (including inset)
} HMSegmentedControlSegmentWidthStyle;
};

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

typedef enum {
typedef NS_ENUM(NSInteger, HMSegmentedControlType) {
HMSegmentedControlTypeText,
HMSegmentedControlTypeImages,
HMSegmentedControlTypeTextImages
} HMSegmentedControlType;
};

@interface HMSegmentedControl : UIControl

Expand Down

0 comments on commit 709704c

Please sign in to comment.