Skip to content

Commit 9e66e89

Browse files
committed
Gate all references to iOS 26 APIs
1 parent 57ae929 commit 9e66e89

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

TORoundedButton/TORoundedButton.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ IB_DESIGNABLE @interface TORoundedButton : UIControl
8989
/// When `backgroundStyle` is set to `.blur`, the specific blur style to apply.
9090
@property (nonatomic, assign) UIBlurEffectStyle blurStyle;
9191

92+
#ifdef __IPHONE_26_0
9293
/// When `backgroundStyle` is set to `.glass`, the specific glass style to apply.
9394
@property (nonatomic, assign) UIGlassEffectStyle glassStyle API_AVAILABLE(ios(26.0));
95+
#endif
9496

9597
/// The text that is displayed in center of the button (Default is nil).
9698
/// This adds an internally controlled label view to the main content view.

TORoundedButton/TORoundedButton.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,15 @@ - (UIView *)_makeBackgroundViewWithStyle:(TORoundedButtonBackgroundStyle)style T
184184
if (!TORoundedButtonIsSolidBackground(style)) {
185185
// Create a glass or blur style based on the associated style
186186
UIVisualEffect *effect = nil;
187+
#ifdef __IPHONE_26_0
187188
if (@available(iOS 26.0, *)) {
188189
if (style == TORoundedButtonBackgroundStyleGlass) {
189190
UIGlassEffect *const glassEffect = [UIGlassEffect effectWithStyle:_glassStyle];
190191
glassEffect.tintColor = self.tintColor;
191192
effect = glassEffect;
192193
}
193194
}
195+
#endif
194196
if (effect == nil) {
195197
UIBlurEffect *const blurEffect = [UIBlurEffect effectWithStyle:_blurStyle];
196198
effect = blurEffect;
@@ -204,11 +206,15 @@ - (UIView *)_makeBackgroundViewWithStyle:(TORoundedButtonBackgroundStyle)style T
204206
backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
205207

206208
backgroundView.clipsToBounds = !TORoundedButtonIsSolidBackground(style);
209+
#ifdef __IPHONE_26_0
207210
if (@available(iOS 26.0, *)) {
208211
backgroundView.cornerConfiguration = _cornerConfiguration;
209212
} else {
210213
backgroundView.layer.cornerRadius = _cornerRadius;
211214
}
215+
#else
216+
backgroundView.layer.cornerRadius = _cornerRadius;
217+
#endif
212218

213219
#ifdef __IPHONE_13_0
214220
if (@available(iOS 13.0, *)) { backgroundView.layer.cornerCurve = kCACornerCurveContinuous; }
@@ -613,6 +619,7 @@ - (void)setBlurStyle:(UIBlurEffectStyle)blurStyle {
613619
[blurView setEffect:[UIBlurEffect effectWithStyle:_blurStyle]];
614620
}
615621

622+
#ifdef __IPHONE_26_0
616623
- (void)setGlassStyle:(UIGlassEffectStyle)glassStyle {
617624
if (_glassStyle == glassStyle) { return; }
618625
_glassStyle = glassStyle;
@@ -627,6 +634,7 @@ - (void)setGlassStyle:(UIGlassEffectStyle)glassStyle {
627634
UIVisualEffectView *const effectView = (UIVisualEffectView *)_backgroundView;
628635
[effectView setEffect:glassEffect];
629636
}
637+
#endif
630638

631639
- (void)setEnabled:(BOOL)enabled {
632640
[super setEnabled:enabled];

0 commit comments

Comments
 (0)