diff --git a/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/IDP/SFSDKUITableViewCell.m b/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/IDP/SFSDKUITableViewCell.m index 7cc398237d..1337dd9172 100644 --- a/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/IDP/SFSDKUITableViewCell.m +++ b/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/IDP/SFSDKUITableViewCell.m @@ -84,7 +84,11 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr [self.detailLabel.topAnchor constraintEqualToAnchor:self.titleLabel.bottomAnchor constant:4].active = YES; - [self.detailLabel.leftAnchor constraintEqualToAnchor:self.profileImageView.rightAnchor constant:12].active = YES; + [self.detailLabel.leftAnchor constraintEqualToAnchor:self.profileImageView.rightAnchor constant:12].active = YES; + + [self registerForTraitChanges:@[UITraitUserInterfaceStyle.self] withHandler:^(SFSDKUITableViewCell *cell, UITraitCollection *previousCollection) { + [cell updateLayerColor]; + }]; return self; } @@ -92,12 +96,6 @@ - (void)updateLayerColor { self.layer.borderColor = [UIColor salesforceSystemBackgroundColor].CGColor; } -- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { - [super traitCollectionDidChange:previousTraitCollection]; - if ([self.traitCollection hasDifferentColorAppearanceComparedToTraitCollection:previousTraitCollection]) { - [self updateLayerColor]; - } -} - (void)awakeFromNib { [super awakeFromNib]; diff --git a/native/SampleApps/RestAPIExplorer/RestAPIExplorer/ViewControllers/RootViewController.swift b/native/SampleApps/RestAPIExplorer/RestAPIExplorer/ViewControllers/RootViewController.swift index 75dcd7ac94..3f7b690cf7 100644 --- a/native/SampleApps/RestAPIExplorer/RestAPIExplorer/ViewControllers/RootViewController.swift +++ b/native/SampleApps/RestAPIExplorer/RestAPIExplorer/ViewControllers/RootViewController.swift @@ -135,6 +135,10 @@ class RootViewController: UIViewController { super.viewDidLoad() self.view.backgroundColor = UIColor.appContentBackground + registerForTraitChanges([UITraitUserInterfaceStyle.self]) { (self: RootViewController, _: UITraitCollection) in + self.updateBorderColor() + } + NotificationCenter.default.addObserver(self, selector: #selector(clearPopoversForPasscode), name: NSNotification.Name(rawValue: kSFScreenLockFlowWillBegin), @@ -541,12 +545,6 @@ class RootViewController: UIViewController { return self.responseSection.container } - override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { - super.traitCollectionDidChange(previousTraitCollection) - if traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) { - self.updateBorderColor() - } - } func updateBorderColor() -> Void { for textField in self.textFields {