Skip to content

Commit b170c61

Browse files
Merge branch 'refactor/borders' into refactor/previews
2 parents 7ac0d10 + 6e674e4 commit b170c61

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

Sources/ComponentsKit/Components/Modal/UIKit/UKModalController.swift

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ open class UKModalController<VM: ModalVM>: UIViewController {
8686
target: self,
8787
action: #selector(self.handleOverlayTap)
8888
))
89+
90+
if #available(iOS 17.0, *) {
91+
self.registerForTraitChanges([UITraitUserInterfaceStyle.self]) { (controller: Self, _: UITraitCollection) in
92+
controller.handleTraitChanges()
93+
}
94+
}
8995
}
9096

9197
@objc func handleOverlayTap() {
@@ -188,6 +194,21 @@ open class UKModalController<VM: ModalVM>: UIViewController {
188194
}
189195
self.containerWidthConstraint?.isActive = true
190196
}
197+
198+
// MARK: - UIViewController Methods
199+
200+
open override func traitCollectionDidChange(
201+
_ previousTraitCollection: UITraitCollection?
202+
) {
203+
super.traitCollectionDidChange(previousTraitCollection)
204+
self.handleTraitChanges()
205+
}
206+
207+
// MARK: - Helpers
208+
209+
@objc private func handleTraitChanges() {
210+
Self.Style.content(self.content, model: self.model)
211+
}
191212
}
192213

193214
// MARK: - Style Helpers
@@ -211,7 +232,6 @@ extension UKModalController {
211232
static func content(_ view: UIView, model: VM) {
212233
view.backgroundColor = model.preferredBackgroundColor.uiColor
213234
view.layer.cornerRadius = model.cornerRadius.value
214-
view.clipsToBounds = true
215235
view.layer.borderColor = UniversalColor.divider.cgColor
216236
view.layer.borderWidth = model.borderWidth.value
217237
}

0 commit comments

Comments
 (0)