From 84688eedff8bb14e3fc2f1cd6338d9f0608f709f Mon Sep 17 00:00:00 2001 From: Alexander Borsuk Date: Mon, 2 Jan 2023 19:40:00 +0100 Subject: [PATCH] [xcode] Fixed compilation for older XCode 13.2.1 Signed-off-by: Alexander Borsuk --- .../PlacePageHeader/PlacePageHeaderViewController.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderViewController.swift b/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderViewController.swift index 0d515095e4..598e860216 100644 --- a/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderViewController.swift +++ b/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderViewController.swift @@ -51,7 +51,8 @@ extension PlacePageHeaderViewController: PlacePageHeaderViewProtocol { } func setTitle(_ title: String?, secondaryTitle: String?) { - guard let title else { + // XCode 13 is not smart enough to detect that title is used below, and requires explicit unwrapped variable. + guard let unwrappedTitle = title else { titleLabel?.attributedText = nil return } @@ -61,9 +62,9 @@ extension PlacePageHeaderViewController: PlacePageHeaderViewProtocol { .foregroundColor: UIColor.blackPrimaryText() ] - let attributedText = NSMutableAttributedString(string: title, attributes: titleAttributes) + let attributedText = NSMutableAttributedString(string: unwrappedTitle, attributes: titleAttributes) - guard let secondaryTitle else { + guard let unwrappedSecondaryTitle = secondaryTitle else { titleLabel?.attributedText = attributedText return } @@ -76,7 +77,7 @@ extension PlacePageHeaderViewController: PlacePageHeaderViewProtocol { .paragraphStyle: paragraphStyle ] - attributedText.append(NSAttributedString(string: "\n" + secondaryTitle, attributes: secondaryTitleAttributes)) + attributedText.append(NSAttributedString(string: "\n" + unwrappedSecondaryTitle, attributes: secondaryTitleAttributes)) titleLabel?.attributedText = attributedText } }