@@ -63,6 +63,18 @@ open class InteractiveSheetViewController: OWSViewController {
6363 open var sheetBackgroundColor : UIColor { Theme . actionSheetBackgroundColor }
6464 open var handleBackgroundColor : UIColor { Theme . tableView2PresentedSeparatorColor }
6565
66+ /// Override to `true` to make the content appear on a glass background on
67+ /// iOS 26 and later. `sheetBackgroundColor` will be ignored when on glass,
68+ /// but still be sure to set it for devices running iOS 18 and older.
69+ open var placeOnGlassIfAvailable : Bool { false }
70+ private var isOnGlass : Bool {
71+ if #available( iOS 26 , * ) , FeatureFlags . iOS26SDKIsAvailable {
72+ placeOnGlassIfAvailable
73+ } else {
74+ false
75+ }
76+ }
77+
6678 public weak var externalBackdropView : UIView ?
6779 private lazy var _internalBackdropView = UIView ( )
6880 public var backdropView : UIView ? { externalBackdropView ?? _internalBackdropView }
@@ -154,7 +166,8 @@ open class InteractiveSheetViewController: OWSViewController {
154166 view. addSubview ( sheetContainerView)
155167 sheetCurrentOffsetConstraint = sheetContainerView. autoPinEdge ( toSuperviewEdge: . bottom)
156168 sheetContainerView. autoHCenterInSuperview ( )
157- sheetContainerView. backgroundColor = sheetBackgroundColor
169+
170+ let margin : CGFloat = isOnGlass ? 8 : 0
158171
159172 // Prefer to be full width, but don't exceed the maximum width
160173 sheetContainerView. autoSetDimension ( . width, toSize: maxWidth, relation: . lessThanOrEqual)
@@ -165,7 +178,12 @@ open class InteractiveSheetViewController: OWSViewController {
165178 }
166179
167180 sheetContainerContentView. addSubview ( sheetStackView)
168- sheetStackView. autoPinEdgesToSuperviewEdges ( )
181+ sheetStackView. autoPinEdgesToSuperviewEdges ( with: . init(
182+ top: 0 ,
183+ left: margin,
184+ bottom: margin,
185+ right: margin
186+ ) )
169187
170188 contentView. preservesSuperviewLayoutMargins = true
171189 sheetStackView. addArrangedSubview ( contentView)
@@ -187,6 +205,18 @@ open class InteractiveSheetViewController: OWSViewController {
187205
188206 // Setup handle for interactive dismissal / resizing
189207 setupInteractiveSizing ( )
208+
209+ if #available( iOS 26 . 0 , * ) , isOnGlass {
210+ #if compiler(>=6.2)
211+ sheetContainerView. backgroundColor = . clear
212+ let glassBackground = UIVisualEffectView ( effect: UIGlassEffect ( style: . regular) )
213+ sheetContainerView. insertSubview ( glassBackground, at: 0 )
214+ glassBackground. autoPinEdges ( toEdgesOf: sheetStackView)
215+ glassBackground. cornerConfiguration = . uniformCorners( radius: . containerConcentric( minimum: 20 ) )
216+ #endif
217+ } else {
218+ sheetContainerView. backgroundColor = sheetBackgroundColor
219+ }
190220 }
191221
192222 open override func viewDidDisappear( _ animated: Bool ) {
@@ -198,7 +228,11 @@ open class InteractiveSheetViewController: OWSViewController {
198228 super. themeDidChange ( )
199229
200230 handle. backgroundColor = handleBackgroundColor
201- sheetContainerView. backgroundColor = sheetBackgroundColor
231+ sheetContainerView. backgroundColor = if isOnGlass {
232+ . clear
233+ } else {
234+ sheetBackgroundColor
235+ }
202236 }
203237
204238 @objc
@@ -482,7 +516,17 @@ open class InteractiveSheetViewController: OWSViewController {
482516
483517 // Add resistance above the max preferred height
484518 if newHeight > maxHeight {
485- newHeight = maxHeight + ( newHeight - maxHeight) / resistanceDivisor
519+ if isOnGlass {
520+ // Doing a transform keeps the glass background the same
521+ // height and prevents its concentric corners from shirking
522+ // as they get farther from the edges of the screen.
523+ sheetContainerView. transform = . translate( . init( x: 0 , y: ( maxHeight - newHeight) / resistanceDivisor) )
524+ newHeight = maxHeight
525+ } else {
526+ // When not on glass, we want the bottom of the sheet to
527+ // extend to the bottom of the screen, so don't transform.
528+ newHeight = maxHeight + ( newHeight - maxHeight) / resistanceDivisor
529+ }
486530 }
487531
488532 // Don't go past the max allowed height
@@ -576,6 +620,7 @@ open class InteractiveSheetViewController: OWSViewController {
576620
577621 sheetPanDelegate? . sheetPanDecelerationDidBegin ( )
578622 self . animate {
623+ self . sheetContainerView. transform = . identity
579624 self . sheetCurrentOffsetConstraint? . constant = finalOffset
580625 self . sheetCurrentHeightConstraint. constant = finalHeight
581626 self . view. layoutIfNeeded ( )
0 commit comments