Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions TORoundedButton/TORoundedButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ IB_DESIGNABLE @interface TORoundedButton : UIControl
/// When `backgroundStyle` is set to `.blur`, the specific blur style to apply.
@property (nonatomic, assign) UIBlurEffectStyle blurStyle;

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

/// The text that is displayed in center of the button (Default is nil).
/// This adds an internally controlled label view to the main content view.
Expand Down
8 changes: 8 additions & 0 deletions TORoundedButton/TORoundedButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,15 @@ - (UIView *)_makeBackgroundViewWithStyle:(TORoundedButtonBackgroundStyle)style T
if (!TORoundedButtonIsSolidBackground(style)) {
// Create a glass or blur style based on the associated style
UIVisualEffect *effect = nil;
#ifdef __IPHONE_26_0
if (@available(iOS 26.0, *)) {
if (style == TORoundedButtonBackgroundStyleGlass) {
UIGlassEffect *const glassEffect = [UIGlassEffect effectWithStyle:_glassStyle];
glassEffect.tintColor = self.tintColor;
effect = glassEffect;
}
}
#endif
if (effect == nil) {
UIBlurEffect *const blurEffect = [UIBlurEffect effectWithStyle:_blurStyle];
effect = blurEffect;
Expand All @@ -204,11 +206,15 @@ - (UIView *)_makeBackgroundViewWithStyle:(TORoundedButtonBackgroundStyle)style T
backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

backgroundView.clipsToBounds = !TORoundedButtonIsSolidBackground(style);
#ifdef __IPHONE_26_0
if (@available(iOS 26.0, *)) {
backgroundView.cornerConfiguration = _cornerConfiguration;
} else {
backgroundView.layer.cornerRadius = _cornerRadius;
}
#else
backgroundView.layer.cornerRadius = _cornerRadius;
#endif

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

#ifdef __IPHONE_26_0
- (void)setGlassStyle:(UIGlassEffectStyle)glassStyle {
if (_glassStyle == glassStyle) { return; }
_glassStyle = glassStyle;
Expand All @@ -627,6 +634,7 @@ - (void)setGlassStyle:(UIGlassEffectStyle)glassStyle {
UIVisualEffectView *const effectView = (UIVisualEffectView *)_backgroundView;
[effectView setEffect:glassEffect];
}
#endif

- (void)setEnabled:(BOOL)enabled {
[super setEnabled:enabled];
Expand Down
Loading