@@ -46,7 +46,7 @@ + (nonnull instancetype)groupWithCheckBoxes:(nullable NSArray<BEMCheckBox *> *)c
46
46
}
47
47
48
48
- (void )addCheckBoxToGroup : (nonnull BEMCheckBox *)checkBox {
49
- if ([checkBox group ]){
49
+ if ([checkBox group ]) {
50
50
// Already has a group, remove first
51
51
[[checkBox group ] removeCheckBoxFromGroup: checkBox];
52
52
}
@@ -57,7 +57,7 @@ - (void)addCheckBoxToGroup:(nonnull BEMCheckBox *)checkBox {
57
57
}
58
58
59
59
- (void )removeCheckBoxFromGroup : (nonnull BEMCheckBox *)checkBox {
60
- if (![self .checkBoxes containsObject: checkBox]){
60
+ if (![self .checkBoxes containsObject: checkBox]) {
61
61
// Not in this group
62
62
return ;
63
63
}
@@ -81,11 +81,11 @@ - (BEMCheckBox *)selectedCheckBox {
81
81
}
82
82
83
83
- (void )setSelectedCheckBox : (BEMCheckBox *)selectedCheckBox {
84
- if (selectedCheckBox){
85
- for (BEMCheckBox *b in self.checkBoxes ) {
86
- BOOL shouldBeOn = (b == selectedCheckBox);
87
- if ([b on ] != shouldBeOn){
88
- [b _setOn: shouldBeOn animated: YES notifyGroup: NO ];
84
+ if (selectedCheckBox) {
85
+ for (BEMCheckBox *checkBox in self.checkBoxes ) {
86
+ BOOL shouldBeOn = (checkBox == selectedCheckBox);
87
+ if ([checkBox on ] != shouldBeOn){
88
+ [checkBox _setOn: shouldBeOn animated: YES notifyGroup: NO ];
89
89
}
90
90
}
91
91
} else {
@@ -104,19 +104,19 @@ - (void)setSelectedCheckBox:(BEMCheckBox *)selectedCheckBox {
104
104
}
105
105
}
106
106
107
- - (void )setMustHaveSelection : (BOOL )mustHaveSelection {
107
+ - (void )setMustHaveSelection : (BOOL )mustHaveSelection {
108
108
_mustHaveSelection = mustHaveSelection;
109
109
110
110
// If it must have a selection and we currently don't, select the first box
111
- if (mustHaveSelection && !self.selectedCheckBox ){
111
+ if (mustHaveSelection && !self.selectedCheckBox ) {
112
112
[self setSelectedCheckBox: [self .checkBoxes firstObject ]];
113
113
}
114
114
}
115
115
116
116
#pragma mark Private methods called by BEMCheckBox
117
117
118
118
- (void )_checkBoxSelectionChanged : (BEMCheckBox *)checkBox {
119
- if ([checkBox on ]){
119
+ if ([checkBox on ]) {
120
120
// Change selected checkbox to this one
121
121
[self setSelectedCheckBox: checkBox];
122
122
} else if (checkBox == self.selectedCheckBox ) {
0 commit comments