From 311a462f1c1cb5ae7ec16da464c4dde56d0bd73c Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 8 Nov 2021 22:47:57 +0100 Subject: [PATCH] Update background color on traitCollectionDidChange. --- .../Toast/ToastViews/AppleToastView/AppleToastView.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/Toast/ToastViews/AppleToastView/AppleToastView.swift b/Sources/Toast/ToastViews/AppleToastView/AppleToastView.swift index 931ee31..26799d8 100644 --- a/Sources/Toast/ToastViews/AppleToastView/AppleToastView.swift +++ b/Sources/Toast/ToastViews/AppleToastView/AppleToastView.swift @@ -54,6 +54,12 @@ public class AppleToastView : UIView, ToastView { style() } + public override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + UIView.animate(withDuration: 0.5) { + self.style() + } + } + private func style() { layoutIfNeeded() clipsToBounds = true