diff --git a/iphone/Maps/Bookmarks/Catalog/PaidRouteViewController.swift b/iphone/Maps/Bookmarks/Catalog/PaidRouteViewController.swift index 572f975e9f..96a58afe39 100644 --- a/iphone/Maps/Bookmarks/Catalog/PaidRouteViewController.swift +++ b/iphone/Maps/Bookmarks/Catalog/PaidRouteViewController.swift @@ -58,7 +58,7 @@ class PaidRouteViewController: MWMViewController { override func viewDidLoad() { super.viewDidLoad() - buyButton.layer.borderColor = UIColor.linkBlue()?.cgColor + buyButton.layer.borderColor = UIColor.linkBlue().cgColor routeTitleLabel.text = name routeAuthorLabel.text = author if let url = imageUrl { diff --git a/iphone/Maps/Categories/Bundle+Init.swift b/iphone/Maps/Categories/Bundle+Init.swift index 81708cdfc6..e0462b21c7 100644 --- a/iphone/Maps/Categories/Bundle+Init.swift +++ b/iphone/Maps/Categories/Bundle+Init.swift @@ -1,6 +1,6 @@ extension Bundle { @objc func load(viewClass: AnyClass, owner: Any? = nil, options: [AnyHashable: Any]? = nil) -> [Any]? { - return loadNibNamed(toString(viewClass), owner: owner, options: options as! [UINib.OptionsKey : Any]) + return loadNibNamed(toString(viewClass), owner: owner, options: options as? [UINib.OptionsKey : Any]) } @objc func load(plist: String) -> Dictionary? { diff --git a/iphone/Maps/Categories/UIColor+MapsMeColor.h b/iphone/Maps/Categories/UIColor+MapsMeColor.h index 8cf8fb1539..6323fc05ac 100644 --- a/iphone/Maps/Categories/UIColor+MapsMeColor.h +++ b/iphone/Maps/Categories/UIColor+MapsMeColor.h @@ -1,5 +1,5 @@ #import "UIColor+PartnerColor.h" - +NS_ASSUME_NONNULL_BEGIN @interface UIColor (MapsMeColor) + (UIColor *)primaryDark; @@ -75,3 +75,4 @@ + (UIColor *)facebookButtonBackgroundDisabled; @end +NS_ASSUME_NONNULL_END diff --git a/iphone/Maps/Categories/UIColor+PartnerColor.h b/iphone/Maps/Categories/UIColor+PartnerColor.h index 311384940d..9c444d44b2 100644 --- a/iphone/Maps/Categories/UIColor+PartnerColor.h +++ b/iphone/Maps/Categories/UIColor+PartnerColor.h @@ -14,4 +14,5 @@ + (UIColor *)partner20Background; + (UIColor *)partner20TextColor; -@end \ No newline at end of file +@end + diff --git a/iphone/Maps/Categories/UIColor+PartnerColor.mm b/iphone/Maps/Categories/UIColor+PartnerColor.mm index 7d7b261aa4..ea68d917a3 100644 --- a/iphone/Maps/Categories/UIColor+PartnerColor.mm +++ b/iphone/Maps/Categories/UIColor+PartnerColor.mm @@ -52,4 +52,5 @@ return [UIColor colorWithRed:scaled(255) green:scaled(255) blue:scaled(255) alpha:100]; } -@end \ No newline at end of file +@end + diff --git a/iphone/Maps/Categories/UIFont+MapsMeFonts.h b/iphone/Maps/Categories/UIFont+MapsMeFonts.h index 58df665778..9c31d55e96 100644 --- a/iphone/Maps/Categories/UIFont+MapsMeFonts.h +++ b/iphone/Maps/Categories/UIFont+MapsMeFonts.h @@ -1,3 +1,4 @@ +NS_ASSUME_NONNULL_BEGIN @interface UIFont (MapsMeFonts) + (UIFont *)regular9; @@ -47,3 +48,4 @@ + (UIFont *)fontWithName:(NSString *)fontName; @end +NS_ASSUME_NONNULL_END diff --git a/iphone/Maps/Classes/CarPlay/CarPlayRouter.swift b/iphone/Maps/Classes/CarPlay/CarPlayRouter.swift index f2dcc8675c..09f6361c1b 100644 --- a/iphone/Maps/Classes/CarPlay/CarPlayRouter.swift +++ b/iphone/Maps/Classes/CarPlay/CarPlayRouter.swift @@ -276,7 +276,7 @@ extension CarPlayRouter { longitude: startPoint.longitude)) let endPlacemark = MKPlacemark(coordinate: CLLocationCoordinate2D(latitude: endPoint.latitude, longitude: endPoint.longitude), - addressDictionary: [CNPostalAddressStreetKey: endPoint.subtitle]) + addressDictionary: [CNPostalAddressStreetKey: endPoint.subtitle ?? ""]) let startItem = MKMapItem(placemark: startPlacemark) let endItem = MKMapItem(placemark: endPlacemark) endItem.name = endPoint.title diff --git a/iphone/Maps/Classes/Components/ExpandableReviewView/ExpandableReviewView.swift b/iphone/Maps/Classes/Components/ExpandableReviewView/ExpandableReviewView.swift index ded9ffae1f..7cedc21a6a 100644 --- a/iphone/Maps/Classes/Components/ExpandableReviewView/ExpandableReviewView.swift +++ b/iphone/Maps/Classes/Components/ExpandableReviewView/ExpandableReviewView.swift @@ -103,7 +103,7 @@ final class ExpandableReviewView: UIView { let height = (text as NSString).boundingRect(with: CGSize(width: contentLabel.bounds.width, height: .greatestFiniteMagnitude), options: .usesLineFragmentOrigin, - attributes: [.font: contentLabel.font], + attributes: [.font: contentLabel.font ?? UIFont.regular16], context: nil).height if height > contentLabel.bounds.height { moreLabelZeroHeight.isActive = false diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitIntermediatePoint.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitIntermediatePoint.swift index 2a0fd474c3..2bb5998feb 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitIntermediatePoint.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitIntermediatePoint.swift @@ -1,6 +1,6 @@ final class TransportTransitIntermediatePoint: TransportTransitCell { enum Config { - static var imageColor: UIColor { return UIColor.primary()! } + static var imageColor: UIColor { return UIColor.primary() } } @IBOutlet private weak var image: UIImageView! diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitPedestrian.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitPedestrian.swift index 3164060da9..fc339d8bb8 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitPedestrian.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitPedestrian.swift @@ -1,8 +1,8 @@ final class TransportTransitPedestrian: TransportTransitCell { enum Config { static let backgroundCornerRadius: CGFloat = 4 - static var backgroundColor: UIColor { return UIColor.blackOpaque()! } - static var imageColor: UIColor { return UIColor.blackSecondaryText()! } + static var backgroundColor: UIColor { return UIColor.blackOpaque() } + static var imageColor: UIColor { return UIColor.blackSecondaryText() } } @IBOutlet private weak var background: UIView! { diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitSeparator.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitSeparator.swift index dea48d9cfb..834a3d5493 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitSeparator.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitSeparator.swift @@ -1,6 +1,6 @@ final class TransportTransitSeparator: UICollectionReusableView { enum Config { - static var imageColor: UIColor { return UIColor.blackSecondaryText()! } + static var imageColor: UIColor { return UIColor.blackSecondaryText() } } override init(frame: CGRect) { diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitTrain.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitTrain.swift index d194903607..53efec52ed 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitTrain.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus/TransportTransitSteps/TransportTransitTrain.swift @@ -2,7 +2,7 @@ final class TransportTransitTrain: TransportTransitCell { enum Config { static let backgroundCornerRadius: CGFloat = 4 static var labelTextColor: UIColor { return .white } - static let labelTextFont = UIFont.bold12()! + static let labelTextFont = UIFont.bold12() static let labelTrailing: CGFloat = 4 } diff --git a/iphone/Maps/Common/Statistics/Statistics.h b/iphone/Maps/Common/Statistics/Statistics.h index b492bbc94d..fe6d8be900 100644 --- a/iphone/Maps/Common/Statistics/Statistics.h +++ b/iphone/Maps/Common/Statistics/Statistics.h @@ -22,6 +22,6 @@ typedef NS_ENUM(NSInteger, StatisticsChannel) { + (void)logEvent:(NSString *)eventName withParameters:(NSDictionary *)parameters atLocation:(CLLocation *)location withChannel:(StatisticsChannel)channel; -+ (NSString *)connectionTypeString; ++ (NSString * _Nonnull)connectionTypeString; @end diff --git a/iphone/Maps/Core/Ads/BannerType.swift b/iphone/Maps/Core/Ads/BannerType.swift index bd12dd260e..e08776a173 100644 --- a/iphone/Maps/Core/Ads/BannerType.swift +++ b/iphone/Maps/Core/Ads/BannerType.swift @@ -48,12 +48,12 @@ extension BannerType: Equatable { } extension BannerType: Hashable { - var hashValue: Int { + func hash(into hasher: inout Hasher){ switch self { - case .none: return mwmType.hashValue - case let .facebook(id): return mwmType.hashValue ^ id.hashValue - case let .rb(id): return mwmType.hashValue ^ id.hashValue - case let .mopub(id): return mwmType.hashValue ^ id.hashValue + case .none: hasher.combine(mwmType.hashValue) + case let .facebook(id): hasher.combine(mwmType.hashValue ^ id.hashValue) + case let .rb(id): hasher.combine(mwmType.hashValue ^ id.hashValue) + case let .mopub(id): hasher.combine(mwmType.hashValue ^ id.hashValue) } } } diff --git a/iphone/Maps/Core/Ads/Mopub/MopubBanner.swift b/iphone/Maps/Core/Ads/Mopub/MopubBanner.swift index df8287fd9d..036dcc5a5b 100644 --- a/iphone/Maps/Core/Ads/Mopub/MopubBanner.swift +++ b/iphone/Maps/Core/Ads/Mopub/MopubBanner.swift @@ -46,7 +46,7 @@ final class MopubBanner: NSObject, Banner { var type: BannerType { return .mopub(bannerID) } var mwmType: MWMBannerType { return type.mwmType } - var bannerID: String! { return placementID } + var bannerID: String { return placementID } var statisticsDescription: [String: String] { return [kStatBanner: bannerID, kStatProvider: kStatMopub] diff --git a/iphone/Maps/Core/Ads/RB/RBBanner.swift b/iphone/Maps/Core/Ads/RB/RBBanner.swift index 11a8549ba8..dd69b4fec7 100644 --- a/iphone/Maps/Core/Ads/RB/RBBanner.swift +++ b/iphone/Maps/Core/Ads/RB/RBBanner.swift @@ -134,9 +134,9 @@ extension RBBanner: MTRGNativeAdDelegate { func onNoAd(withReason reason: String!, nativeAd: MTRGNativeAd!) { guard nativeAd === self else { return } let params: [String: Any] = [ - kStatBanner: bannerID, + kStatBanner: bannerID ?? "", kStatProvider: kStatRB, - kStatReason: reason, + kStatReason: reason ?? "", ] let event = kStatPlacePageBannerError let error = NSError(domain: kMapsmeErrorDomain, code: 1001, userInfo: params) diff --git a/iphone/Maps/Core/BackgroundFetchScheduler/BackgroundFetchTask/BackgroundFetchTask.swift b/iphone/Maps/Core/BackgroundFetchScheduler/BackgroundFetchTask/BackgroundFetchTask.swift index 527c62efb4..a6237d8fa0 100644 --- a/iphone/Maps/Core/BackgroundFetchScheduler/BackgroundFetchTask/BackgroundFetchTask.swift +++ b/iphone/Maps/Core/BackgroundFetchScheduler/BackgroundFetchTask/BackgroundFetchTask.swift @@ -20,7 +20,7 @@ fileprivate func finish(_ result: UIBackgroundFetchResult) { guard backgroundTaskIdentifier != UIBackgroundTaskIdentifier.invalid else { return } - UIApplication.shared.endBackgroundTask(convertToUIBackgroundTaskIdentifier(backgroundTaskIdentifier.rawValue)) + UIApplication.shared.endBackgroundTask(UIBackgroundTaskIdentifier(rawValue: backgroundTaskIdentifier.rawValue)) backgroundTaskIdentifier = UIBackgroundTaskIdentifier.invalid completionHandler?(result) } @@ -60,8 +60,3 @@ final class BackgroundUGCUpload: BackgroundFetchTask { return "UGC upload" } } - -// Helper function inserted by Swift 4.2 migrator. -fileprivate func convertToUIBackgroundTaskIdentifier(_ input: Int) -> UIBackgroundTaskIdentifier { - return UIBackgroundTaskIdentifier(rawValue: input) -} diff --git a/iphone/Maps/Core/InappPurchase/Impl/BillingPendingTransaction.swift b/iphone/Maps/Core/InappPurchase/Impl/BillingPendingTransaction.swift index 4600a03f77..0b5a93ae04 100644 --- a/iphone/Maps/Core/InappPurchase/Impl/BillingPendingTransaction.swift +++ b/iphone/Maps/Core/InappPurchase/Impl/BillingPendingTransaction.swift @@ -11,7 +11,7 @@ final class BillingPendingTransaction: NSObject, IBillingPendingTransaction { } var status: TransactionStatus { - var routeTransactions = SKPaymentQueue.default().transactions.filter { + let routeTransactions = SKPaymentQueue.default().transactions.filter { var isOk = !Subscription.legacyProductIds.contains($0.payment.productIdentifier) && !Subscription.productIds.contains($0.payment.productIdentifier) if isOk && $0.transactionState == .purchasing { diff --git a/iphone/Maps/Core/Notifications/MWMPushNotifications.h b/iphone/Maps/Core/Notifications/MWMPushNotifications.h index f88ef65516..3fe0fc1282 100644 --- a/iphone/Maps/Core/Notifications/MWMPushNotifications.h +++ b/iphone/Maps/Core/Notifications/MWMPushNotifications.h @@ -18,6 +18,6 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler; -+ (NSString *)formattedTimestamp; ++ (NSString * _Nonnull)formattedTimestamp; @end diff --git a/iphone/Maps/Core/Notifications/MWMPushNotifications.mm b/iphone/Maps/Core/Notifications/MWMPushNotifications.mm index 24ae6d1377..ed2cd3eebd 100644 --- a/iphone/Maps/Core/Notifications/MWMPushNotifications.mm +++ b/iphone/Maps/Core/Notifications/MWMPushNotifications.mm @@ -91,7 +91,7 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:completionHandler]; } -+ (NSString *)formattedTimestamp { ++ (NSString * _Nonnull)formattedTimestamp { return @(GetPlatform().GetMarketingService().GetPushWooshTimestamp().c_str()); } diff --git a/iphone/Maps/UI/CarPlay/CarPlayMapViewController.swift b/iphone/Maps/UI/CarPlay/CarPlayMapViewController.swift index 2c1f8ec426..a6fa767e30 100644 --- a/iphone/Maps/UI/CarPlay/CarPlayMapViewController.swift +++ b/iphone/Maps/UI/CarPlay/CarPlayMapViewController.swift @@ -71,7 +71,7 @@ final class CarPlayMapViewController: MWMViewController { private func updateSpeedControl() { currentSpeedLabel.text = "\(currentSpeed)" if isCameraOnRoute { - speedLimitContainer.layer.borderColor = UIColor.speedLimitRed()?.cgColor + speedLimitContainer.layer.borderColor = UIColor.speedLimitRed().cgColor speedLimitContainer.layer.borderWidth = 2.0 if let speedLimit = speedLimit { speedCamImageView.alpha = 0.0 @@ -92,7 +92,7 @@ final class CarPlayMapViewController: MWMViewController { currentSpeedView.backgroundColor = UIColor.speedLimitWhite() } } else { - speedLimitContainer.layer.borderColor = UIColor.speedLimitLightGray()?.cgColor + speedLimitContainer.layer.borderColor = UIColor.speedLimitLightGray().cgColor speedLimitContainer.layer.borderWidth = 2.0 speedLimitLabel.alpha = 0.0 speedCamImageView.tintColor = UIColor.speedLimitLightGray() diff --git a/iphone/Maps/UI/Discovery/Collection Cells/DiscoveryGuideCell.swift b/iphone/Maps/UI/Discovery/Collection Cells/DiscoveryGuideCell.swift index 212ff1622c..362c384f50 100644 --- a/iphone/Maps/UI/Discovery/Collection Cells/DiscoveryGuideCell.swift +++ b/iphone/Maps/UI/Discovery/Collection Cells/DiscoveryGuideCell.swift @@ -90,7 +90,7 @@ final class DiscoveryGuideCell: UICollectionViewCell { } proLabel.text = label if let labelHexColor = labelHexColor, labelHexColor.count == 6 { - proContainer.backgroundColor = UIColor(fromHexString: labelHexColor) ?? UIColor.ratingRed() + proContainer.backgroundColor = UIColor(fromHexString: labelHexColor) } else { proContainer.backgroundColor = UIColor.ratingRed() } diff --git a/iphone/Maps/UI/Discovery/Table Cells/DiscoveryOnlineTemplateCell.swift b/iphone/Maps/UI/Discovery/Table Cells/DiscoveryOnlineTemplateCell.swift index 3844cf055e..91f6c2b548 100644 --- a/iphone/Maps/UI/Discovery/Table Cells/DiscoveryOnlineTemplateCell.swift +++ b/iphone/Maps/UI/Discovery/Table Cells/DiscoveryOnlineTemplateCell.swift @@ -18,7 +18,7 @@ final class DiscoveryOnlineTemplateCell: MWMTableViewCell { containerView.backgroundColor = UIColor.white() containerView.layer.cornerRadius = 6.0 containerView.layer.borderWidth = 1.0 - containerView.layer.borderColor = UIColor.blackDividers()?.cgColor + containerView.layer.borderColor = UIColor.blackDividers().cgColor } } @IBOutlet var header: UILabel! diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/CatalogPromo/CatalogSingleItemCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/CatalogPromo/CatalogSingleItemCell.swift index 2b69c0fe47..a60312967a 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/CatalogPromo/CatalogSingleItemCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/CatalogPromo/CatalogSingleItemCell.swift @@ -14,7 +14,7 @@ override func awakeFromNib() { super.awakeFromNib() - guideContainerView.layer.borderColor = UIColor.blackDividers()?.cgColor + guideContainerView.layer.borderColor = UIColor.blackDividers().cgColor } @objc func config(_ promoItem: CatalogPromoItem) { diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Photos/PhotosOverlayView.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Photos/PhotosOverlayView.swift index b95c0da834..44fcdabad2 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Photos/PhotosOverlayView.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Photos/PhotosOverlayView.swift @@ -52,10 +52,9 @@ final class PhotosOverlayView: UIView { navigationBar.items = [navigationItem] addSubview(navigationBar) - let topConstraint = NSLayoutConstraint(item: navigationBar, attribute: .top, relatedBy: .equal, toItem: self, attribute: .top, multiplier: 1.0, constant: statusBarHeight()) - let widthConstraint = NSLayoutConstraint(item: navigationBar, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 1.0, constant: 0.0) - let horizontalPositionConstraint = NSLayoutConstraint(item: navigationBar, attribute: .centerX, relatedBy: .equal, toItem: self, attribute: .centerX, multiplier: 1.0, constant: 0.0) - addConstraints([topConstraint, widthConstraint, horizontalPositionConstraint]) + navigationBar.topAnchor.constraint(equalTo: self.topAnchor).isActive = true + navigationBar.widthAnchor.constraint(equalTo: self.widthAnchor).isActive = true + navigationBar.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true navigationItem.leftBarButtonItem = UIBarButtonItem(image: #imageLiteral(resourceName: "ic_nav_bar_back"), style: .plain, target: self, action: #selector(closeButtonTapped(_:))) } diff --git a/xcode/omim.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/xcode/omim.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings index 3ddf867a10..dc8d12300f 100644 --- a/xcode/omim.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ b/xcode/omim.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -4,5 +4,7 @@ BuildSystemType Latest + IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded +