Skip to content

Commit eca589b

Browse files
committed
Made setPresentationBackground save to run/update n times on AppKitBackend
1 parent 12198f7 commit eca589b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/AppKitBackend/AppKitBackend.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,10 +1736,17 @@ public final class AppKitBackend: AppBackend {
17361736
}
17371737

17381738
public func setPresentationBackground(of sheet: NSCustomSheet, to color: Color) {
1739+
if let backgroundView = sheet.backgroundView {
1740+
backgroundView.layer?.backgroundColor = color.nsColor.cgColor
1741+
return
1742+
}
1743+
17391744
let backgroundView = NSView()
17401745
backgroundView.wantsLayer = true
17411746
backgroundView.layer?.backgroundColor = color.nsColor.cgColor
17421747

1748+
sheet.backgroundView = backgroundView
1749+
17431750
if let existingContentView = sheet.contentView {
17441751
let container = NSView()
17451752
container.translatesAutoresizingMaskIntoConstraints = false
@@ -1777,6 +1784,8 @@ public final class NSCustomSheet: NSCustomWindow, NSWindowDelegate {
17771784

17781785
public var interactiveDismissDisabled: Bool = false
17791786

1787+
public var backgroundView: NSView?
1788+
17801789
public func dismiss() {
17811790
onDismiss?()
17821791
self.contentViewController?.dismiss(self)

0 commit comments

Comments
 (0)