diff options
author | Ilya Grechuhin <i.grechuhin@gmail.com> | 2017-09-21 14:09:55 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <bykoianko@gmail.com> | 2017-09-27 19:04:41 +0300 |
commit | 9a70b67794a7c2d17476f80b4aa1d622a0906ea0 (patch) | |
tree | 6c35fa995aeb81dd6b178a70116128919420b491 | |
parent | 9cb6917793ab67369c1c2bf3d2e02d615d97277b (diff) |
[xcode-9] [ios] Migrated to Swift 4.
69 files changed, 220 insertions, 186 deletions
diff --git a/iphone/Maps/Categories/Bundle+Init.swift b/iphone/Maps/Categories/Bundle+Init.swift index 87a39e9ee0..ff1a9358e2 100644 --- a/iphone/Maps/Categories/Bundle+Init.swift +++ b/iphone/Maps/Categories/Bundle+Init.swift @@ -1,5 +1,5 @@ extension Bundle { - func load(viewClass: AnyClass, owner: Any? = nil, options: [AnyHashable: Any]? = nil) -> [Any]? { + @objc func load(viewClass: AnyClass, owner: Any? = nil, options: [AnyHashable: Any]? = nil) -> [Any]? { return loadNibNamed(toString(viewClass), owner: owner, options: options) } } diff --git a/iphone/Maps/Categories/DateComponentsFormatter+ETA.swift b/iphone/Maps/Categories/DateComponentsFormatter+ETA.swift index 010a7f8f6d..0a694cb44b 100644 --- a/iphone/Maps/Categories/DateComponentsFormatter+ETA.swift +++ b/iphone/Maps/Categories/DateComponentsFormatter+ETA.swift @@ -1,6 +1,5 @@ extension DateComponentsFormatter { - - static func etaString(from ti: TimeInterval) -> String? { + @objc static func etaString(from ti: TimeInterval) -> String? { let formatter = DateComponentsFormatter() formatter.allowedUnits = [.minute, .hour, .day] formatter.maximumUnitCount = 2 diff --git a/iphone/Maps/Categories/String+BoundingRect.swift b/iphone/Maps/Categories/String+BoundingRect.swift index 667adcf569..30a2c11446 100644 --- a/iphone/Maps/Categories/String+BoundingRect.swift +++ b/iphone/Maps/Categories/String+BoundingRect.swift @@ -5,7 +5,7 @@ extension String { let maximumHeight = maxNumberOfLines == 0 ? CGFloat.greatestFiniteMagnitude : font.lineHeight * CGFloat(maxNumberOfLines + 1) let constraintSize = CGSize(width: width, height: maximumHeight) let options: NSStringDrawingOptions = [.usesLineFragmentOrigin, .usesFontLeading] - let attributes = [NSFontAttributeName: font] + let attributes = [NSAttributedStringKey.font: font] let rect = (self as NSString).boundingRect(with: constraintSize, options: options, attributes: attributes, context: nil) var numberOfLines = ceil(rect.height / font.lineHeight) if maxNumberOfLines != 0 { diff --git a/iphone/Maps/Categories/UICollectionView+Cells.swift b/iphone/Maps/Categories/UICollectionView+Cells.swift index b791cb3ed8..b49cbd6f76 100644 --- a/iphone/Maps/Categories/UICollectionView+Cells.swift +++ b/iphone/Maps/Categories/UICollectionView+Cells.swift @@ -1,9 +1,9 @@ extension UICollectionView { - func register(cellClass: AnyClass) { + @objc func register(cellClass: AnyClass) { register(UINib(cellClass), forCellWithReuseIdentifier: toString(cellClass)) } - func dequeueReusableCell(withCellClass cellClass: AnyClass, indexPath: IndexPath) -> UICollectionViewCell { + @objc func dequeueReusableCell(withCellClass cellClass: AnyClass, indexPath: IndexPath) -> UICollectionViewCell { return dequeueReusableCell(withReuseIdentifier: toString(cellClass), for: indexPath) } } diff --git a/iphone/Maps/Categories/UINib+Init.swift b/iphone/Maps/Categories/UINib+Init.swift index 5b85731ee2..d9f270067b 100644 --- a/iphone/Maps/Categories/UINib+Init.swift +++ b/iphone/Maps/Categories/UINib+Init.swift @@ -1,5 +1,5 @@ extension UINib { - convenience init(_ viewClass: AnyClass, bundle: Bundle? = nil) { + @objc convenience init(_ viewClass: AnyClass, bundle: Bundle? = nil) { self.init(nibName: toString(viewClass), bundle: bundle) } } diff --git a/iphone/Maps/Categories/UITableView+Cells.swift b/iphone/Maps/Categories/UITableView+Cells.swift index 5e732f28f6..079ae1925f 100644 --- a/iphone/Maps/Categories/UITableView+Cells.swift +++ b/iphone/Maps/Categories/UITableView+Cells.swift @@ -1,13 +1,13 @@ extension UITableView { - func register(cellClass: AnyClass) { + @objc func register(cellClass: AnyClass) { register(UINib(cellClass), forCellReuseIdentifier: toString(cellClass)) } - func dequeueReusableCell(withCellClass cellClass: AnyClass) -> UITableViewCell? { + @objc func dequeueReusableCell(withCellClass cellClass: AnyClass) -> UITableViewCell? { return dequeueReusableCell(withIdentifier: toString(cellClass)) } - func dequeueReusableCell(withCellClass cellClass: AnyClass, indexPath: IndexPath) -> UITableViewCell { + @objc func dequeueReusableCell(withCellClass cellClass: AnyClass, indexPath: IndexPath) -> UITableViewCell { return dequeueReusableCell(withIdentifier: toString(cellClass), for: indexPath) } } diff --git a/iphone/Maps/Categories/UITableView+Updates.swift b/iphone/Maps/Categories/UITableView+Updates.swift index 660322cf22..e76a84f76a 100644 --- a/iphone/Maps/Categories/UITableView+Updates.swift +++ b/iphone/Maps/Categories/UITableView+Updates.swift @@ -2,13 +2,13 @@ extension UITableView { typealias Updates = () -> Void typealias Completion = () -> Void - func update(_ updates: Updates) { + @objc func update(_ updates: Updates) { beginUpdates() updates() endUpdates() } - func update(_ updates: Updates, completion: @escaping Completion) { + @objc func update(_ updates: Updates, completion: @escaping Completion) { CATransaction.begin() beginUpdates() CATransaction.setCompletionBlock(completion) @@ -17,7 +17,7 @@ extension UITableView { CATransaction.commit() } - func refresh() { + @objc func refresh() { update {} } } diff --git a/iphone/Maps/Categories/UIView+Hierarchy.swift b/iphone/Maps/Categories/UIView+Hierarchy.swift index ba36db3e7e..fc2ce2e376 100644 --- a/iphone/Maps/Categories/UIView+Hierarchy.swift +++ b/iphone/Maps/Categories/UIView+Hierarchy.swift @@ -1,5 +1,5 @@ extension UIView { - func hasSubview(viewClass: AnyClass) -> Bool { + @objc func hasSubview(viewClass: AnyClass) -> Bool { return !subviews.filter { type(of: $0) == viewClass }.isEmpty } } diff --git a/iphone/Maps/Categories/UIView+Snapshot.swift b/iphone/Maps/Categories/UIView+Snapshot.swift index 7c06ac8e2a..1207d92632 100644 --- a/iphone/Maps/Categories/UIView+Snapshot.swift +++ b/iphone/Maps/Categories/UIView+Snapshot.swift @@ -1,7 +1,7 @@ import UIKit extension UIView { - var snapshot: UIView { + @objc var snapshot: UIView { guard let contents = layer.contents else { return snapshotView(afterScreenUpdates: true)! } diff --git a/iphone/Maps/Categories/UIViewController+Hierarchy.swift b/iphone/Maps/Categories/UIViewController+Hierarchy.swift index d9d7f7004c..1cd149fa03 100644 --- a/iphone/Maps/Categories/UIViewController+Hierarchy.swift +++ b/iphone/Maps/Categories/UIViewController+Hierarchy.swift @@ -1,5 +1,5 @@ extension UIViewController { - static func topViewController() -> UIViewController { + @objc static func topViewController() -> UIViewController { let window = UIApplication.shared.delegate!.window!! return (window.rootViewController as! UINavigationController).topViewController! } diff --git a/iphone/Maps/Classes/Components/BorderedButton.swift b/iphone/Maps/Classes/Components/BorderedButton.swift index f10e5a4694..2b3d037b64 100644 --- a/iphone/Maps/Classes/Components/BorderedButton.swift +++ b/iphone/Maps/Classes/Components/BorderedButton.swift @@ -5,15 +5,15 @@ final class BorderedButton: UIButton { private var borderHighlightedColor: UIColor? private var borderDisabledColor: UIColor? - func setBorderColor(_ color: UIColor) { + @objc func setBorderColor(_ color: UIColor) { borderColor = color } - func setBorderHighlightedColor(_ color: UIColor) { + @objc func setBorderHighlightedColor(_ color: UIColor) { borderHighlightedColor = color } - func setBorderDisabledColor(_ color: UIColor) { + @objc func setBorderDisabledColor(_ color: UIColor) { borderDisabledColor = color } diff --git a/iphone/Maps/Classes/Components/DimBackground.swift b/iphone/Maps/Classes/Components/DimBackground.swift index da96fcd84a..4f3b075faf 100644 --- a/iphone/Maps/Classes/Components/DimBackground.swift +++ b/iphone/Maps/Classes/Components/DimBackground.swift @@ -3,7 +3,7 @@ final class DimBackground: SolidTouchView { private let mainView: UIView private var tapAction: (() -> Void)! - init(mainView: UIView) { + @objc init(mainView: UIView) { self.mainView = mainView super.init(frame: mainView.superview!.bounds) backgroundColor = UIColor.fadeBackground() @@ -15,8 +15,7 @@ final class DimBackground: SolidTouchView { fatalError("init(coder:) has not been implemented") } - @objc - func setVisible(_ visible: Bool, tapAction: @escaping () -> Void) { + @objc func setVisible(_ visible: Bool, tapAction: @escaping () -> Void) { self.tapAction = tapAction if visible { diff --git a/iphone/Maps/Classes/Components/RatingSummaryView/RatingSummaryView.swift b/iphone/Maps/Classes/Components/RatingSummaryView/RatingSummaryView.swift index 8d8e05167e..11aaa102a9 100644 --- a/iphone/Maps/Classes/Components/RatingSummaryView/RatingSummaryView.swift +++ b/iphone/Maps/Classes/Components/RatingSummaryView/RatingSummaryView.swift @@ -293,7 +293,7 @@ import UIKit private func createTextLayer() -> CALayer { let font = textFont.withSize(textSize) let text = String(format: "%.1f", value) - let size = NSString(string: text).size(attributes: [NSFontAttributeName: font]) + let size = NSString(string: text).size(withAttributes: [NSAttributedStringKey.font: font]) let layer = CATextLayer() layer.bounds = CGRect(origin: CGPoint(), diff --git a/iphone/Maps/Classes/Components/RatingView/RatingView.swift b/iphone/Maps/Classes/Components/RatingView/RatingView.swift index 50779e9bd6..99425c9cfb 100644 --- a/iphone/Maps/Classes/Components/RatingView/RatingView.swift +++ b/iphone/Maps/Classes/Components/RatingView/RatingView.swift @@ -401,7 +401,7 @@ import UIKit private func createStarLayers() -> [CALayer] { var ratingRemainder = value - var starLayers: [CALayer] = (0..<settings.starsCount).map { _ in + var starLayers: [CALayer] = (0 ..< settings.starsCount).map { _ in let fillLevel = starFillLevel(ratingRemainder: ratingRemainder) let layer = createCompositeStarLayer(fillLevel: fillLevel) ratingRemainder -= 1 @@ -426,7 +426,7 @@ import UIKit var layers: [RatingViewSettings.TextSide: CALayer] = [:] for (side, text) in texts { let font = settings.textFonts[side]!.withSize(settings.textSizes[side]!) - let size = NSString(string: text).size(attributes: [NSFontAttributeName: font]) + let size = NSString(string: text).size(withAttributes: [NSAttributedStringKey.font: font]) let layer = CATextLayer() layer.bounds = CGRect(origin: CGPoint(), @@ -564,7 +564,7 @@ import UIKit path = UIBezierPath(roundedRect: CGRect(origin: CGPoint(), size: CGSize(width: size, height: size)), cornerRadius: size / 4) } path.move(to: points.first!) - points[1..<points.count].forEach { path.addLine(to: $0) } + points[1 ..< points.count].forEach { path.addLine(to: $0) } path.close() return path diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/NavigationAddPointToastView.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/NavigationAddPointToastView.swift index 1a88604e5c..15092a6822 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/NavigationAddPointToastView.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/NavigationAddPointToastView.swift @@ -7,20 +7,22 @@ final class NavigationAddPointToastView: UIView { actionButton.titleLabel?.font = UIFont.regular16() } } + @IBOutlet private var locationButton: UIButton! { didSet { locationButton.tintColor = UIColor.linkBlue() } } + @IBOutlet private var separator: UIView! { didSet { separator.backgroundColor = UIColor.blackDividers() } } - private(set) var isStart = true + @objc private(set) var isStart = true - func config(isStart: Bool, withLocationButton: Bool) { + @objc func config(isStart: Bool, withLocationButton: Bool) { self.isStart = isStart let text = isStart ? L("routing_add_start_point") : L("routing_add_finish_point") actionButton.setTitle(text, for: .normal) diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/NavigationControlView.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/NavigationControlView.swift index ed3963efd5..be9d4cbfd8 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/NavigationControlView.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/NavigationControlView.swift @@ -39,13 +39,13 @@ final class NavigationControlView: SolidTouchView, MWMTextToSpeechObserver, MWMT DimBackground(mainView: self) }() - weak var ownerView: UIView! + @objc weak var ownerView: UIView! private weak var navigationInfo: MWMNavigationDashboardEntity? private var hiddenConstraint: NSLayoutConstraint! private var extendedConstraint: NSLayoutConstraint! - var isVisible = false { + @objc var isVisible = false { didSet { guard isVisible != oldValue else { return } if isVisible { @@ -94,15 +94,15 @@ final class NavigationControlView: SolidTouchView, MWMTextToSpeechObserver, MWMT NSLayoutConstraint(item: self, attribute: .right, relatedBy: .equal, toItem: ownerView, attribute: .right, multiplier: 1, constant: 0).isActive = true hiddenConstraint = NSLayoutConstraint(item: self, attribute: .top, relatedBy: .equal, toItem: ownerView, attribute: .bottom, multiplier: 1, constant: 0) - hiddenConstraint.priority = UILayoutPriorityDefaultHigh + hiddenConstraint.priority = UILayoutPriority.defaultHigh hiddenConstraint.isActive = true let visibleConstraint = NSLayoutConstraint(item: progressView, attribute: .bottom, relatedBy: .equal, toItem: ownerView, attribute: .bottom, multiplier: 1, constant: 0) - visibleConstraint.priority = UILayoutPriorityDefaultLow + visibleConstraint.priority = UILayoutPriority.defaultLow visibleConstraint.isActive = true extendedConstraint = NSLayoutConstraint(item: self, attribute: .bottom, relatedBy: .equal, toItem: ownerView, attribute: .bottom, multiplier: 1, constant: 0) - extendedConstraint.priority = UILayoutPriorityDefaultHigh - 1 + extendedConstraint.priority = UILayoutPriority(rawValue: UILayoutPriority.RawValue(Int(UILayoutPriority.defaultHigh.rawValue) - 1)) } override func mwm_refreshUI() { @@ -133,14 +133,20 @@ final class NavigationControlView: SolidTouchView, MWMTextToSpeechObserver, MWMT timePageControl.transform = CGAffineTransform(scaleX: pgScale, y: pgScale) } - func onNavigationInfoUpdated(_ info: MWMNavigationDashboardEntity) { + @objc func onNavigationInfoUpdated(_ info: MWMNavigationDashboardEntity) { navigationInfo = info guard !MWMRouter.isTaxi() else { return } - let routingNumberAttributes: [String: Any] = - [NSForegroundColorAttributeName: UIColor.blackPrimaryText(), NSFontAttributeName: UIFont.bold24()] - let routingLegendAttributes: [String: Any] = - [NSForegroundColorAttributeName: UIColor.blackSecondaryText(), NSFontAttributeName: UIFont.bold14()] + let routingNumberAttributes: [NSAttributedStringKey: Any] = + [ + NSAttributedStringKey.foregroundColor: UIColor.blackPrimaryText(), + NSAttributedStringKey.font: UIFont.bold24(), + ] + let routingLegendAttributes: [NSAttributedStringKey: Any] = + [ + NSAttributedStringKey.foregroundColor: UIColor.blackSecondaryText(), + NSAttributedStringKey.font: UIFont.bold14(), + ] if timePageControl.currentPage == 0 { timeLabel.text = info.eta diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteManager/RouteManagerTransitioningManager.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteManager/RouteManagerTransitioningManager.swift index 4ad3dec17d..e6a3649368 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteManager/RouteManagerTransitioningManager.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteManager/RouteManagerTransitioningManager.swift @@ -7,7 +7,7 @@ final class RouteManagerTransitioningManager: NSObject, UIViewControllerTransiti super.init() } - init(popoverSourceView: UIView, permittedArrowDirections: UIPopoverArrowDirection) { + @objc init(popoverSourceView: UIView, permittedArrowDirections: UIPopoverArrowDirection) { self.popoverSourceView = popoverSourceView self.permittedArrowDirections = permittedArrowDirections super.init() diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteManager/RouteManagerViewController.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteManager/RouteManagerViewController.swift index 44f462e584..91700ae8fc 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteManager/RouteManagerViewController.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteManager/RouteManagerViewController.swift @@ -128,7 +128,7 @@ final class RouteManagerViewController: MWMViewController, UITableViewDataSource var dragCell: DragCell? - init(viewModel: RouteManagerViewModelProtocol) { + @objc init(viewModel: RouteManagerViewModelProtocol) { self.viewModel = viewModel super.init(nibName: toString(type(of: self)), bundle: nil) } diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus.swift index afce043145..558aea2529 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewStatus.swift @@ -37,7 +37,7 @@ final class RoutePreviewStatus: SolidTouchView { @IBOutlet private var heightBoxBottomManageRouteBoxTop: NSLayoutConstraint! private var hiddenConstraint: NSLayoutConstraint! - weak var ownerView: UIView! + @objc weak var ownerView: UIView! weak var navigationInfo: MWMNavigationDashboardEntity? @@ -81,11 +81,11 @@ final class RoutePreviewStatus: SolidTouchView { NSLayoutConstraint(item: self, attribute: .right, relatedBy: .equal, toItem: ownerView, attribute: .right, multiplier: 1, constant: 0).isActive = true hiddenConstraint = NSLayoutConstraint(item: self, attribute: .top, relatedBy: .equal, toItem: ownerView, attribute: .bottom, multiplier: 1, constant: 0) - hiddenConstraint.priority = UILayoutPriorityDefaultHigh + hiddenConstraint.priority = UILayoutPriority.defaultHigh hiddenConstraint.isActive = true let visibleConstraint = NSLayoutConstraint(item: self, attribute: .bottom, relatedBy: .equal, toItem: ownerView, attribute: .bottom, multiplier: 1, constant: 0) - visibleConstraint.priority = UILayoutPriorityDefaultLow + visibleConstraint.priority = UILayoutPriority.defaultLow visibleConstraint.isActive = true } @@ -120,15 +120,15 @@ final class RoutePreviewStatus: SolidTouchView { manageRouteButtonCompact?.isHidden = !isCompact } - func stateHidden() { + @objc func stateHidden() { isVisible = false } - func statePrepare() { + @objc func statePrepare() { isVisible = false } - func stateError(message: String) { + @objc func stateError(message: String) { isVisible = true errorBox.isHidden = false resultsBox.isHidden = true @@ -141,7 +141,7 @@ final class RoutePreviewStatus: SolidTouchView { updateHeight() } - func stateReady() { + @objc func stateReady() { isVisible = true errorBox.isHidden = true @@ -159,10 +159,11 @@ final class RoutePreviewStatus: SolidTouchView { completion: { image, elevation in self.heightProfileImage.image = image if let elevation = elevation { - let attributes: [String: Any] = [ - NSForegroundColorAttributeName: UIColor.linkBlue(), - NSFontAttributeName: UIFont.medium14(), - ] + let attributes: [NSAttributedStringKey: Any] = + [ + NSAttributedStringKey.foregroundColor: UIColor.linkBlue(), + NSAttributedStringKey.font: UIFont.medium14(), + ] self.elevation = NSAttributedString(string: "▲▼ \(elevation)", attributes: attributes) } }) @@ -174,7 +175,7 @@ final class RoutePreviewStatus: SolidTouchView { updateHeight() } - func stateNavigation() { + @objc func stateNavigation() { isVisible = false } @@ -192,7 +193,7 @@ final class RoutePreviewStatus: SolidTouchView { iPad: { info.estimate })() } - func onNavigationInfoUpdated(_ info: MWMNavigationDashboardEntity) { + @objc func onNavigationInfoUpdated(_ info: MWMNavigationDashboardEntity) { navigationInfo = info updateResultsLabel() arriveLabel?.text = String(coreFormat: L("routing_arrive"), arguments: [info.arrival]) diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewTaxiCell.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewTaxiCell.swift index 0cc4b5f469..5d00dd4833 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewTaxiCell.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RoutePreviewTaxiCell.swift @@ -8,6 +8,7 @@ final class RoutePreviewTaxiCell: UICollectionViewCell { title.textColor = UIColor.blackPrimaryText() } } + @IBOutlet private weak var info: UILabel! { didSet { info.font = UIFont.regular14() @@ -15,7 +16,7 @@ final class RoutePreviewTaxiCell: UICollectionViewCell { } } - func config(type: MWMRoutePreviewTaxiCellType, title: String, eta: String, price: String, currency: String) { + @objc func config(type: MWMRoutePreviewTaxiCellType, title: String, eta: String, price: String, currency: String) { let iconImage = { () -> UIImage in switch type { case .taxi: return #imageLiteral(resourceName: "icTaxiTaxi") diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteStartButton.swift b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteStartButton.swift index b14f4e77b5..14c081bf2a 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteStartButton.swift +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/RouteStartButton.swift @@ -1,16 +1,16 @@ @objc(MWMRouteStartButton) final class RouteStartButton: UIButton { - func statePrepare() { + @objc func statePrepare() { isHidden = false isEnabled = false } - func stateError() { + @objc func stateError() { isHidden = alternative(iPhone: true, iPad: false) isEnabled = false } - func stateReady() { + @objc func stateReady() { isHidden = false isEnabled = true } diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index cafa326a8a..e1c4ee2f78 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -905,7 +905,9 @@ using namespace osm_auth_ios; - (void)setStandbyCounter:(NSInteger)standbyCounter { _standbyCounter = MAX(0, standbyCounter); - UIApplication.sharedApplication.idleTimerDisabled = (_standbyCounter != 0); + dispatch_async(dispatch_get_main_queue(), ^{ + [UIApplication sharedApplication].idleTimerDisabled = (self.standbyCounter != 0); + }); } #pragma mark - Alert logic diff --git a/iphone/Maps/Classes/Share/MWMShareActivityItem.mm b/iphone/Maps/Classes/Share/MWMShareActivityItem.mm index 197c3263f8..b70be6c2fa 100644 --- a/iphone/Maps/Classes/Share/MWMShareActivityItem.mm +++ b/iphone/Maps/Classes/Share/MWMShareActivityItem.mm @@ -85,12 +85,13 @@ NSString * httpGe0Url(NSString * shortUrl) itemForActivityType:(NSString *)activityType { NSString * event = @"MWMShareLocationActivityItem:activityViewController:itemForActivityType:"; + NSString * type = activityType; [Statistics logEvent:kStatEventName(kStatShare, kStatLocation) - withParameters:@{kStatAction : activityType}]; - [Alohalytics logEvent:event withValue:activityType]; - if ([UIActivityTypePostToTwitter isEqualToString:activityType]) + withParameters:@{kStatAction : type}]; + [Alohalytics logEvent:event withValue:type]; + if ([UIActivityTypePostToTwitter isEqualToString:type]) return self.itemForTwitter; - return [self itemDefaultWithActivityType:activityType]; + return [self itemDefaultWithActivityType:type]; } - (NSString *)activityViewController:(UIActivityViewController *)activityViewController @@ -136,7 +137,7 @@ NSString * httpGe0Url(NSString * shortUrl) strings.push_back(self.object.sponsoredDescriptionURL.absoluteString); } - for (auto const str : strings) + for (auto const & str : strings) { if (str.length) [result appendString:[NSString stringWithFormat:@"\n%@", str]]; diff --git a/iphone/Maps/Common/MWMTypes.h b/iphone/Maps/Common/MWMTypes.h index a719c76586..11a2cc3d7d 100644 --- a/iphone/Maps/Common/MWMTypes.h +++ b/iphone/Maps/Common/MWMTypes.h @@ -1,4 +1,4 @@ -typedef void (^MWMVoidBlock)(); +typedef void (^MWMVoidBlock)(void); typedef void (^MWMStringBlock)(NSString *); typedef void (^MWMURLBlock)(NSURL *); diff --git a/iphone/Maps/Core/Ads/BannersCache.swift b/iphone/Maps/Core/Ads/BannersCache.swift index 838e5de386..e377c71341 100644 --- a/iphone/Maps/Core/Ads/BannersCache.swift +++ b/iphone/Maps/Core/Ads/BannersCache.swift @@ -3,7 +3,7 @@ import MyTrackerSDK @objc(MWMBannersCache) final class BannersCache: NSObject { - static let cache = BannersCache() + @objc static let cache = BannersCache() private override init() {} private enum LoadState { @@ -43,7 +43,7 @@ final class BannersCache: NSObject { } } - func get(coreBanners: [CoreBanner], cacheOnly: Bool, loadNew: Bool = true, completion: @escaping Completion) { + @objc func get(coreBanners: [CoreBanner], cacheOnly: Bool, loadNew: Bool = true, completion: @escaping Completion) { self.completion = completion self.cacheOnly = cacheOnly loadStates = coreBanners.map { coreBanner in @@ -110,7 +110,7 @@ final class BannersCache: NSObject { onCompletion(isAsync: true) } - func bannerIsOutOfScreen(coreBanner: MWMBanner) { + @objc func bannerIsOutOfScreen(coreBanner: MWMBanner) { bannerIsOutOfScreen(bannerType: BannerType(type: coreBanner.mwmType, id: coreBanner.bannerID)) } diff --git a/iphone/Maps/Core/Ads/CoreBanner.swift b/iphone/Maps/Core/Ads/CoreBanner.swift index b744f799b2..da09c3bcdd 100644 --- a/iphone/Maps/Core/Ads/CoreBanner.swift +++ b/iphone/Maps/Core/Ads/CoreBanner.swift @@ -3,7 +3,7 @@ final class CoreBanner: NSObject, MWMBanner { let mwmType: MWMBannerType let bannerID: String - init(mwmType: MWMBannerType, bannerID: String) { + @objc init(mwmType: MWMBannerType, bannerID: String) { self.mwmType = mwmType self.bannerID = bannerID } diff --git a/iphone/Maps/Core/Location/MWMLocationManager+SpeedAndAltitude.swift b/iphone/Maps/Core/Location/MWMLocationManager+SpeedAndAltitude.swift index f3f65129f8..d2ff7a940b 100644 --- a/iphone/Maps/Core/Location/MWMLocationManager+SpeedAndAltitude.swift +++ b/iphone/Maps/Core/Location/MWMLocationManager+SpeedAndAltitude.swift @@ -1,14 +1,13 @@ extension MWMLocationManager { - - static func speedSymbolFor(_ speed: Double) -> String { + @objc static func speedSymbolFor(_ speed: Double) -> String { switch max(speed, 0) { - case 0..<1: return "🐢" - case 1..<2: return "🚶" - case 2..<5: return "🏃" - case 5..<10: return "🚲" - case 10..<36: return "🚗" - case 36..<120: return "🚄" - case 120..<278: return "🛩" + case 0 ..< 1: return "🐢" + case 1 ..< 2: return "🚶" + case 2 ..< 5: return "🏃" + case 5 ..< 10: return "🚲" + case 10 ..< 36: return "🚗" + case 36 ..< 120: return "🚄" + case 120 ..< 278: return "🛩" default: return "🚀" } } diff --git a/iphone/Maps/Core/Search/SearchBanners.swift b/iphone/Maps/Core/Search/SearchBanners.swift index 815dd4e5e6..a395fd6c53 100644 --- a/iphone/Maps/Core/Search/SearchBanners.swift +++ b/iphone/Maps/Core/Search/SearchBanners.swift @@ -4,12 +4,12 @@ final class SearchBanners: NSObject { weak var searchIndex: SearchIndex? - init(searchIndex: SearchIndex) { + @objc init(searchIndex: SearchIndex) { self.searchIndex = searchIndex super.init() } - func add(_ banner: MWMBanner) { + @objc func add(_ banner: MWMBanner) { guard let searchIndex = searchIndex else { return } banners.append(banner) let type: MWMSearchItemType @@ -29,7 +29,7 @@ final class SearchBanners: NSObject { searchIndex.addItem(type: type, prefferedPosition: prefferedPosition, containerIndex: banners.count - 1) } - func banner(atIndex index: Int) -> MWMBanner { + @objc func banner(atIndex index: Int) -> MWMBanner { return banners[index] } diff --git a/iphone/Maps/Core/Search/SearchIndex.swift b/iphone/Maps/Core/Search/SearchIndex.swift index 89119187d1..3746959ccb 100644 --- a/iphone/Maps/Core/Search/SearchIndex.swift +++ b/iphone/Maps/Core/Search/SearchIndex.swift @@ -13,11 +13,11 @@ final class SearchIndex: NSObject { private var positionItems: [PositionItem] = [] private var items: [Item] = [] - var count: Int { + @objc var count: Int { return items.count } - init(suggestionsCount: Int, resultsCount: Int) { + @objc init(suggestionsCount: Int, resultsCount: Int) { for index in 0 ..< resultsCount { let type: MWMSearchItemType = index < suggestionsCount ? .suggestion : .regular let item = Item(type: type, containerIndex: index) @@ -32,7 +32,7 @@ final class SearchIndex: NSObject { positionItems.append(PositionItem(item: item, position: prefferedPosition)) } - func build() { + @objc func build() { positionItems.sort(by: >) var itemsDict: [Int: Item] = [:] positionItems.forEach { item in @@ -53,11 +53,11 @@ final class SearchIndex: NSObject { } } - func resultType(row: Int) -> MWMSearchItemType { + @objc func resultType(row: Int) -> MWMSearchItemType { return items[row].type } - func resultContainerIndex(row: Int) -> Int { + @objc func resultContainerIndex(row: Int) -> Int { return items[row].containerIndex } } diff --git a/iphone/Maps/Images.xcassets/AppIcon.appiconset/Contents.json b/iphone/Maps/Images.xcassets/AppIcon.appiconset/Contents.json index 4710409257..5084fd2b3c 100644 --- a/iphone/Maps/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/iphone/Maps/Images.xcassets/AppIcon.appiconset/Contents.json @@ -97,6 +97,11 @@ "idiom" : "ipad", "filename" : "83.5x83.5@2x.png", "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index feb6664153..319ba8a2c5 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -4773,7 +4773,7 @@ }; 6741A93D1BF340DE002C974C = { DevelopmentTeam = 3T6FSDE8C7; - LastSwiftMigration = 0820; + LastSwiftMigration = 0900; ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.Push = { @@ -7098,7 +7098,8 @@ SWIFT_OBJC_BRIDGING_HEADER = "Bridging-Header.h"; SWIFT_OBJC_INTERFACE_HEADER_NAME = SwiftBridge.h; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALID_ARCHS = "i386 x86_64"; VERSIONING_SYSTEM = "apple-generic"; @@ -7203,7 +7204,8 @@ SWIFT_OBJC_BRIDGING_HEADER = "Bridging-Header.h"; SWIFT_OBJC_INTERFACE_HEADER_NAME = SwiftBridge.h; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALID_ARCHS = "armv7 armv7s arm64"; VERSIONING_SYSTEM = "apple-generic"; @@ -7310,7 +7312,8 @@ SWIFT_OBJC_BRIDGING_HEADER = "Bridging-Header.h"; SWIFT_OBJC_INTERFACE_HEADER_NAME = SwiftBridge.h; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VALID_ARCHS = "armv7 armv7s arm64"; @@ -7418,7 +7421,8 @@ SWIFT_OBJC_BRIDGING_HEADER = "Bridging-Header.h"; SWIFT_OBJC_INTERFACE_HEADER_NAME = SwiftBridge.h; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VALID_ARCHS = "armv7 armv7s arm64"; @@ -7527,7 +7531,8 @@ SWIFT_OBJC_BRIDGING_HEADER = "Bridging-Header.h"; SWIFT_OBJC_INTERFACE_HEADER_NAME = SwiftBridge.h; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALID_ARCHS = "armv7 armv7s arm64"; VERSIONING_SYSTEM = "apple-generic"; @@ -7636,7 +7641,8 @@ SWIFT_OBJC_BRIDGING_HEADER = "Bridging-Header.h"; SWIFT_OBJC_INTERFACE_HEADER_NAME = SwiftBridge.h; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALID_ARCHS = "i386 x86_64"; VERSIONING_SYSTEM = "apple-generic"; diff --git a/iphone/Maps/Maps.xcodeproj/xcshareddata/xcschemes/ci.MAPS.ME.xcscheme b/iphone/Maps/Maps.xcodeproj/xcshareddata/xcschemes/ci.MAPS.ME.xcscheme index e8f31e5928..09b1d6f820 100644 --- a/iphone/Maps/Maps.xcodeproj/xcshareddata/xcschemes/ci.MAPS.ME.xcscheme +++ b/iphone/Maps/Maps.xcodeproj/xcshareddata/xcschemes/ci.MAPS.ME.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0820" + LastUpgradeVersion = "0900" version = "1.3"> <BuildAction parallelizeBuildables = "YES" @@ -26,6 +26,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" shouldUseLaunchSchemeArgsEnv = "YES"> <Testables> </Testables> @@ -45,6 +46,7 @@ buildConfiguration = "Release" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/iphone/Maps/Maps.xcodeproj/xcshareddata/xcschemes/scheme_cmMAPS.ME.xcscheme b/iphone/Maps/Maps.xcodeproj/xcshareddata/xcschemes/scheme_cmMAPS.ME.xcscheme index aaf3af068d..e6017edfc5 100644 --- a/iphone/Maps/Maps.xcodeproj/xcshareddata/xcschemes/scheme_cmMAPS.ME.xcscheme +++ b/iphone/Maps/Maps.xcodeproj/xcshareddata/xcschemes/scheme_cmMAPS.ME.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0820" + LastUpgradeVersion = "0900" version = "1.3"> <BuildAction parallelizeBuildables = "YES" @@ -26,6 +26,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" shouldUseLaunchSchemeArgsEnv = "YES"> <Testables> </Testables> @@ -42,9 +43,10 @@ </AdditionalOptions> </TestAction> <LaunchAction - buildConfiguration = "Release" + buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/iphone/Maps/UI/Ads/AdBanner.swift b/iphone/Maps/UI/Ads/AdBanner.swift index 6f1b9e6f19..f0b615f84d 100644 --- a/iphone/Maps/UI/Ads/AdBanner.swift +++ b/iphone/Maps/UI/Ads/AdBanner.swift @@ -12,14 +12,14 @@ enum AdBannerState: Int { switch self { case .unset: assert(false) - return (priority: 0, numberOfTitleLines: 0, numberOfBodyLines: 0) + return (priority: UILayoutPriority(rawValue: 0), numberOfTitleLines: 0, numberOfBodyLines: 0) case .compact: - return alternative(iPhone: (priority: UILayoutPriorityDefaultLow, numberOfTitleLines: 1, numberOfBodyLines: 2), - iPad: (priority: UILayoutPriorityDefaultHigh, numberOfTitleLines: 0, numberOfBodyLines: 0)) + return alternative(iPhone: (priority: UILayoutPriority.defaultLow, numberOfTitleLines: 1, numberOfBodyLines: 2), + iPad: (priority: UILayoutPriority.defaultHigh, numberOfTitleLines: 0, numberOfBodyLines: 0)) case .search: - return (priority: UILayoutPriorityDefaultLow, numberOfTitleLines: 2, numberOfBodyLines: 0) + return (priority: UILayoutPriority.defaultLow, numberOfTitleLines: 2, numberOfBodyLines: 0) case .detailed: - return (priority: UILayoutPriorityDefaultHigh, numberOfTitleLines: 0, numberOfBodyLines: 0) + return (priority: UILayoutPriority.defaultHigh, numberOfTitleLines: 0, numberOfBodyLines: 0) } } } @@ -41,9 +41,9 @@ final class AdBanner: UITableViewCell { @IBOutlet private weak var adCallToActionButtonDetailed: UIButton! @IBOutlet private weak var adCallToActionButtonCustom: UIButton! @IBOutlet private weak var adPrivacyButton: UIButton! - static let detailedBannerExcessHeight: Float = 36 + @objc static let detailedBannerExcessHeight: Float = 36 - var state = AdBannerState.unset { + @objc var state = AdBannerState.unset { didSet { guard state != .unset else { adPrivacyButton.isHidden = true @@ -63,7 +63,7 @@ final class AdBanner: UITableViewCell { } } - weak var mpNativeAd: MPNativeAd? + @objc weak var mpNativeAd: MPNativeAd? override func prepareForReuse() { adIconImageView.af_cancelImageRequest() @@ -86,7 +86,7 @@ final class AdBanner: UITableViewCell { state = .unset } - func config(ad: MWMBanner, containerType: AdBannerContainerType) { + @objc func config(ad: MWMBanner, containerType: AdBannerContainerType) { reset() switch containerType { case .placePage: @@ -110,7 +110,7 @@ final class AdBanner: UITableViewCell { } } - func highlightButton() { + @objc func highlightButton() { adCallToActionButtonDetailed.setBackgroundImage(nil, for: .normal) adCallToActionButtonCompact.setBackgroundImage(nil, for: .normal) @@ -150,9 +150,9 @@ final class AdBanner: UITableViewCell { paragraphStyle.lineBreakMode = .byTruncatingTail let adTitle = NSAttributedString(string: ad.title ?? "", attributes: [ - NSParagraphStyleAttributeName: paragraphStyle, - NSFontAttributeName: UIFont.bold12(), - NSForegroundColorAttributeName: UIColor.blackSecondaryText(), + NSAttributedStringKey.paragraphStyle: paragraphStyle, + NSAttributedStringKey.font: UIFont.bold12(), + NSAttributedStringKey.foregroundColor: UIColor.blackSecondaryText(), ]) adTitleLabel.attributedText = adTitle adBodyLabel.text = ad.body ?? "" @@ -172,9 +172,9 @@ final class AdBanner: UITableViewCell { paragraphStyle.lineBreakMode = .byTruncatingTail let adTitle = NSAttributedString(string: banner.title ?? "", attributes: [ - NSParagraphStyleAttributeName: paragraphStyle, - NSFontAttributeName: UIFont.bold12(), - NSForegroundColorAttributeName: UIColor.blackSecondaryText(), + NSAttributedStringKey.paragraphStyle: paragraphStyle, + NSAttributedStringKey.font: UIFont.bold12(), + NSAttributedStringKey.foregroundColor: UIColor.blackSecondaryText(), ]) adTitleLabel.attributedText = adTitle adBodyLabel.text = banner.descriptionText ?? "" @@ -204,9 +204,9 @@ final class AdBanner: UITableViewCell { paragraphStyle.lineBreakMode = .byTruncatingTail let adTitle = NSAttributedString(string: ad.title, attributes: [ - NSParagraphStyleAttributeName: paragraphStyle, - NSFontAttributeName: UIFont.bold12(), - NSForegroundColorAttributeName: UIColor.blackSecondaryText(), + NSAttributedStringKey.paragraphStyle: paragraphStyle, + NSAttributedStringKey.font: UIFont.bold12(), + NSAttributedStringKey.foregroundColor: UIColor.blackSecondaryText(), ]) adTitleLabel.attributedText = adTitle adBodyLabel.text = ad.text diff --git a/iphone/Maps/UI/Appearance/ThemeManager.swift b/iphone/Maps/UI/Appearance/ThemeManager.swift index c1f84f32ab..9b5350249a 100644 --- a/iphone/Maps/UI/Appearance/ThemeManager.swift +++ b/iphone/Maps/UI/Appearance/ThemeManager.swift @@ -43,11 +43,11 @@ final class ThemeManager: NSObject { } } - static func invalidate() { + @objc static func invalidate() { instance.update(theme: MWMSettings.theme()) } - static var autoUpdates: Bool { + @objc static var autoUpdates: Bool { get { return instance.timer != nil } diff --git a/iphone/Maps/UI/AvailableArea/AvailableArea.swift b/iphone/Maps/UI/AvailableArea/AvailableArea.swift index faa15749fe..faca707261 100644 --- a/iphone/Maps/UI/AvailableArea/AvailableArea.swift +++ b/iphone/Maps/UI/AvailableArea/AvailableArea.swift @@ -88,7 +88,7 @@ class AvailableArea: UIView { func isAreaAffectingView(_: UIView) -> Bool { return false } func addAffectingView(_: UIView) {} - func notifyObserver() {} + @objc func notifyObserver() {} } extension MWMAvailableAreaAffectDirections: Hashable { diff --git a/iphone/Maps/UI/AvailableArea/MenuArea.swift b/iphone/Maps/UI/AvailableArea/MenuArea.swift index b9dab4425e..8e5c4a368b 100644 --- a/iphone/Maps/UI/AvailableArea/MenuArea.swift +++ b/iphone/Maps/UI/AvailableArea/MenuArea.swift @@ -15,7 +15,7 @@ final class MenuArea: AvailableArea { } extension UIView { - var menuAreaAffectDirections: MWMAvailableAreaAffectDirections { return [] } + @objc var menuAreaAffectDirections: MWMAvailableAreaAffectDirections { return [] } var menuAreaAffectView: UIView { return self } } diff --git a/iphone/Maps/UI/AvailableArea/PlacePageArea.swift b/iphone/Maps/UI/AvailableArea/PlacePageArea.swift index 82563f35a1..4cd083c405 100644 --- a/iphone/Maps/UI/AvailableArea/PlacePageArea.swift +++ b/iphone/Maps/UI/AvailableArea/PlacePageArea.swift @@ -15,7 +15,7 @@ final class PlacePageArea: AvailableArea { } extension UIView { - var placePageAreaAffectDirections: MWMAvailableAreaAffectDirections { return [] } + @objc var placePageAreaAffectDirections: MWMAvailableAreaAffectDirections { return [] } var placePageAreaAffectView: UIView { return self } } diff --git a/iphone/Maps/UI/AvailableArea/SideButtonsArea.swift b/iphone/Maps/UI/AvailableArea/SideButtonsArea.swift index 03d9d6e20d..ac009ed23a 100644 --- a/iphone/Maps/UI/AvailableArea/SideButtonsArea.swift +++ b/iphone/Maps/UI/AvailableArea/SideButtonsArea.swift @@ -17,7 +17,7 @@ final class SideButtonsArea: AvailableArea { } extension UIView { - var sideButtonsAreaAffectDirections: MWMAvailableAreaAffectDirections { return [] } + @objc var sideButtonsAreaAffectDirections: MWMAvailableAreaAffectDirections { return [] } var sideButtonsAreaAffectView: UIView { return self } } diff --git a/iphone/Maps/UI/AvailableArea/TrafficButtonArea.swift b/iphone/Maps/UI/AvailableArea/TrafficButtonArea.swift index 77279c8942..a7090b3ef3 100644 --- a/iphone/Maps/UI/AvailableArea/TrafficButtonArea.swift +++ b/iphone/Maps/UI/AvailableArea/TrafficButtonArea.swift @@ -15,7 +15,7 @@ final class TrafficButtonArea: AvailableArea { } extension UIView { - var trafficButtonAreaAffectDirections: MWMAvailableAreaAffectDirections { return [] } + @objc var trafficButtonAreaAffectDirections: MWMAvailableAreaAffectDirections { return [] } var trafficButtonAreaAffectView: UIView { return self } } diff --git a/iphone/Maps/UI/AvailableArea/VisibleArea.swift b/iphone/Maps/UI/AvailableArea/VisibleArea.swift index 4f17d27ac1..7d2512cb4c 100644 --- a/iphone/Maps/UI/AvailableArea/VisibleArea.swift +++ b/iphone/Maps/UI/AvailableArea/VisibleArea.swift @@ -15,7 +15,7 @@ final class VisibleArea: AvailableArea { } extension UIView { - var visibleAreaAffectDirections: MWMAvailableAreaAffectDirections { return [] } + @objc var visibleAreaAffectDirections: MWMAvailableAreaAffectDirections { return [] } var visibleAreaAffectView: UIView { return self } } diff --git a/iphone/Maps/UI/AvailableArea/WidgetsArea.swift b/iphone/Maps/UI/AvailableArea/WidgetsArea.swift index 53d5e2a390..49e7551451 100644 --- a/iphone/Maps/UI/AvailableArea/WidgetsArea.swift +++ b/iphone/Maps/UI/AvailableArea/WidgetsArea.swift @@ -15,7 +15,7 @@ final class WidgetsArea: AvailableArea { } extension UIView { - var widgetsAreaAffectDirections: MWMAvailableAreaAffectDirections { return [] } + @objc var widgetsAreaAffectDirections: MWMAvailableAreaAffectDirections { return [] } var widgetsAreaAffectView: UIView { return self } } diff --git a/iphone/Maps/UI/Downloader/NoMaps/DownloaderNoResultsEmbedViewController.swift b/iphone/Maps/UI/Downloader/NoMaps/DownloaderNoResultsEmbedViewController.swift index 2c2b7919cd..87b9cb6071 100644 --- a/iphone/Maps/UI/Downloader/NoMaps/DownloaderNoResultsEmbedViewController.swift +++ b/iphone/Maps/UI/Downloader/NoMaps/DownloaderNoResultsEmbedViewController.swift @@ -10,7 +10,7 @@ final class DownloaderNoResultsEmbed: UINavigationController { case noSearchResults } - var screen = Screen.noMaps { + @objc var screen = Screen.noMaps { didSet { let controller: MWMViewController switch screen { diff --git a/iphone/Maps/UI/Editor/MWMEditorViewController.mm b/iphone/Maps/UI/Editor/MWMEditorViewController.mm index 059a02e788..5aad900830 100644 --- a/iphone/Maps/UI/Editor/MWMEditorViewController.mm +++ b/iphone/Maps/UI/Editor/MWMEditorViewController.mm @@ -270,7 +270,7 @@ void registerCellsForTableView(vector<MWMEditorCellType> const & cells, UITableV auto & f = GetFramework(); auto const & featureID = m_mapObject.GetID(); - NSDictionary<NSString *, NSString *> * info = @{ + NSDictionary * info = @{ kStatEditorMWMName : @(featureID.GetMwmName().c_str()), kStatEditorMWMVersion : @(featureID.GetMwmVersion()) }; diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPFacilityCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPFacilityCell.swift index a009577b4b..efed405e82 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPFacilityCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPFacilityCell.swift @@ -1,8 +1,8 @@ -@objc (MWMPPFacilityCell) +@objc(MWMPPFacilityCell) final class PPFacilityCell: MWMTableViewCell { @IBOutlet private var facility: UILabel! - func config(with str:String) { + @objc func config(with str: String) { facility.text = str } } diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPHotelCarouselCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPHotelCarouselCell.swift index 456bf66532..19ac901343 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPHotelCarouselCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPHotelCarouselCell.swift @@ -16,7 +16,7 @@ final class PPHotelCarouselCell: MWMTableViewCell { fileprivate let kMaximumNumberOfPhotos = 5 fileprivate weak var delegate: MWMPlacePageButtonsProtocol? - func config(with ds: [GalleryItemModel], delegate d: MWMPlacePageButtonsProtocol?) { + @objc func config(with ds: [GalleryItemModel], delegate d: MWMPlacePageButtonsProtocol?) { dataSource = ds delegate = d collectionView.contentOffset = .zero diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPHotelDescriptionCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPHotelDescriptionCell.swift index 13239b458f..dc3d5f75ae 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPHotelDescriptionCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPHotelDescriptionCell.swift @@ -9,7 +9,7 @@ final class PPHotelDescriptionCell: MWMTableViewCell { private weak var updateDelegate: MWMPlacePageCellUpdateProtocol? private var isNeedToForceLayout: Bool = false - func config(with description: String, delegate: MWMPlacePageCellUpdateProtocol) { + @objc func config(with description: String, delegate: MWMPlacePageCellUpdateProtocol) { descriptionText.text = description descriptionText.sizeToFit() updateDelegate = delegate @@ -23,7 +23,7 @@ final class PPHotelDescriptionCell: MWMTableViewCell { isNeedToForceLayout = false let isCompact = descriptionText.height > kMaximumDescriptionHeight if isCompact { - compactModeConstraints.forEach { $0.priority = UILayoutPriorityDefaultHigh } + compactModeConstraints.forEach { $0.priority = UILayoutPriority.defaultHigh } } hideButton(!isCompact) @@ -32,11 +32,11 @@ final class PPHotelDescriptionCell: MWMTableViewCell { private func hideButton(_ isHidden: Bool = true) { button.isHidden = isHidden - buttonZeroHeight.priority = isHidden ? UILayoutPriorityDefaultHigh : UILayoutPriorityDefaultLow + buttonZeroHeight.priority = isHidden ? UILayoutPriority.defaultHigh : UILayoutPriority.defaultLow } @IBAction private func tap() { - compactModeConstraints.forEach { $0.priority = UILayoutPriorityDefaultLow } + compactModeConstraints.forEach { $0.priority = UILayoutPriority.defaultLow } hideButton() setNeedsLayout() UIView.animate(withDuration: kDefaultAnimationDuration, animations: { [weak self] in diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPReviewHeaderCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPReviewHeaderCell.swift index 58ec7b0e7f..386e26357a 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPReviewHeaderCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/BookingCells/PPReviewHeaderCell.swift @@ -3,9 +3,8 @@ final class PPReviewHeaderCell: UITableViewCell { @IBOutlet private var rating: UILabel! @IBOutlet private var count: UILabel! - func config(with rate: String, numberOfReviews: Int) { + @objc func config(with rate: String, numberOfReviews: Int) { rating.text = rate count.text = String(format: L("booking_based_on_reviews"), numberOfReviews) } - } diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianElement.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianElement.swift index cdc2701b40..9a191932ea 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianElement.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianElement.swift @@ -138,13 +138,13 @@ final class CianElement: UICollectionViewCell { private func configPending() { isSpinning = true details.setTitle(L("preloader_cian_button"), for: .normal) - pendingTitleTopOffset.priority = UILayoutPriorityDefaultLow + pendingTitleTopOffset.priority = UILayoutPriority.defaultLow } private func configError() { isSpinning = false details.setTitle(L("preloader_cian_button"), for: .normal) - pendingTitleTopOffset.priority = UILayoutPriorityDefaultHigh + pendingTitleTopOffset.priority = UILayoutPriority.defaultHigh } private func configOffer(model: CianItemModel?) { diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianItemModel.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianItemModel.swift index 67e47211a8..b8b3af7cfd 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianItemModel.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianItemModel.swift @@ -5,7 +5,7 @@ final class CianItemModel: NSObject { let pageURL: URL let address: String - init(roomsCount: UInt, priceRur: UInt, pageURL: URL, address: String) { + @objc init(roomsCount: UInt, priceRur: UInt, pageURL: URL, address: String) { self.roomsCount = roomsCount self.priceRur = priceRur self.pageURL = pageURL diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/PPCianCarouselCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/PPCianCarouselCell.swift index 8dc95d72e1..59f3cffd5e 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/PPCianCarouselCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/PPCianCarouselCell.swift @@ -19,7 +19,7 @@ final class PPCianCarouselCell: MWMTableViewCell { } @IBOutlet private weak var collectionView: UICollectionView! - var data: [CianItemModel]? { + @objc var data: [CianItemModel]? { didSet { updateCollectionView { [weak self] in self?.collectionView.reloadSections(IndexSet(integer: 0)) @@ -32,7 +32,7 @@ final class PPCianCarouselCell: MWMTableViewCell { fileprivate var statisticsParameters: [AnyHashable: Any] { return [kStatProvider: kStatCian] } - func config(delegate d: MWMPlacePageButtonsProtocol?) { + @objc func config(delegate d: MWMPlacePageButtonsProtocol?) { delegate = d collectionView.contentOffset = .zero collectionView.delegate = self diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/GalleryViewController.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/GalleryViewController.swift index 136dc6484f..69e444f064 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/GalleryViewController.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/GalleryViewController.swift @@ -3,7 +3,7 @@ final class GalleryViewController: MWMCollectionViewController { typealias Cell = GalleryCell typealias Model = GalleryModel - static func instance(model: Model) -> GalleryViewController { + @objc static func instance(model: Model) -> GalleryViewController { let vc = GalleryViewController(nibName: toString(self), bundle: nil) vc.model = model return vc diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Models/GalleryItemModel.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Models/GalleryItemModel.swift index 6e977345ab..ca5e3b3b5f 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Models/GalleryItemModel.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Models/GalleryItemModel.swift @@ -3,7 +3,7 @@ final class GalleryItemModel: NSObject { let imageURL: URL let previewURL: URL - init(imageURL: URL, previewURL: URL) { + @objc init(imageURL: URL, previewURL: URL) { self.imageURL = imageURL self.previewURL = previewURL } diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Models/GalleryModel.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Models/GalleryModel.swift index 428a6c7c3d..1865d9d2e6 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Models/GalleryModel.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Models/GalleryModel.swift @@ -1,9 +1,9 @@ @objc(MWMGalleryModel) final class GalleryModel: NSObject { let title: String - let items: [GalleryItemModel] + @objc let items: [GalleryItemModel] - init(title: String, items: [GalleryItemModel]) { + @objc init(title: String, items: [GalleryItemModel]) { self.title = title self.items = items } diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Photos/PhotosInteractionAnimator.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Photos/PhotosInteractionAnimator.swift index 0c03106718..1b662256d6 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Photos/PhotosInteractionAnimator.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Photos/PhotosInteractionAnimator.swift @@ -32,34 +32,46 @@ final class PhotosInteractionAnimator: NSObject { } } - private func finishPanWith(transitionContext: UIViewControllerContextTransitioning, velocityY: CGFloat, verticalDelta: CGFloat, viewToPan: UIView, fromView: UIView, anchorPoint: CGPoint) { - let dismissDistance = Settings.panDismissDistanceRatio * fromView.bounds.height - let isDismissing = abs(verticalDelta) > dismissDistance - - if isDismissing, shouldAnimateUsingAnimator, let animator = animator { - animator.animateTransition(using: transitionContext) - self.transitionContext = nil - return - } + private func finalBackgroundAlpha(isDismissing: Bool) -> CGFloat { + return isDismissing ? 0 : 1 + } + fileprivate func panEstimation(_ isDismissing: Bool, _ fromViewMidY: CGFloat, _ modifier: CGFloat, _ fromViewHeight: CGFloat, _ fromViewCenterX: CGFloat, _ viewToPanCenterY: CGFloat, _ velocityY: CGFloat, _ anchorPoint: CGPoint) -> (CGPoint, TimeInterval) { let finalPageViewCenterPoint: CGPoint let animationDuration: TimeInterval - let finalBackgroundAlpha: CGFloat if isDismissing { - let modifier: CGFloat = verticalDelta.sign == .plus ? 1 : -1 - let finalCenterY = fromView.bounds.midY + modifier * fromView.bounds.height - finalPageViewCenterPoint = CGPoint(x: fromView.center.x, y: finalCenterY) + let finalCenterY = fromViewMidY + modifier * fromViewHeight + finalPageViewCenterPoint = CGPoint(x: fromViewCenterX, y: finalCenterY) - let duration = TimeInterval(abs(finalPageViewCenterPoint.y - viewToPan.center.y) / abs(velocityY)) + let duration = TimeInterval(abs((finalPageViewCenterPoint.y - viewToPanCenterY) / velocityY)) animationDuration = min(duration, Settings.panDismissMaximumDuration) - finalBackgroundAlpha = 0.0 } else { finalPageViewCenterPoint = anchorPoint animationDuration = TimeInterval(abs(velocityY) * Settings.returnToCenterVelocityAnimationRatio) + kDefaultAnimationDuration - finalBackgroundAlpha = 1.0 } - let finalBackgroundColor = fromView.backgroundColor?.withAlphaComponent(finalBackgroundAlpha) + + return (finalPageViewCenterPoint, animationDuration) + } + + private func finishPanWith(transitionContext: UIViewControllerContextTransitioning, velocityY: CGFloat, verticalDelta: CGFloat, viewToPan: UIView, fromView: UIView, anchorPoint: CGPoint) { + let fromViewHeight = fromView.bounds.height + let fromViewMidY = fromView.bounds.midY + let fromViewCenterX = fromView.center.x + let viewToPanCenterY = viewToPan.center.y + let modifier: CGFloat = verticalDelta.sign == .plus ? 1 : -1 + + let dismissDistance = Settings.panDismissDistanceRatio * fromViewHeight + let isDismissing = abs(verticalDelta) > dismissDistance + + if isDismissing, shouldAnimateUsingAnimator, let animator = animator { + animator.animateTransition(using: transitionContext) + self.transitionContext = nil + return + } + + let (finalPageViewCenterPoint, animationDuration) = panEstimation(isDismissing, fromViewMidY, modifier, fromViewHeight, fromViewCenterX, viewToPanCenterY, velocityY, anchorPoint) + let finalBackgroundColor = fromView.backgroundColor?.withAlphaComponent(finalBackgroundAlpha(isDismissing: isDismissing)) finishPanWithoutAnimator(duration: animationDuration, viewToPan: viewToPan, fromView: fromView, diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Photos/PhotosViewController.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Photos/PhotosViewController.swift index 8793cd0e66..002fcd324b 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Photos/PhotosViewController.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Gallery/Photos/PhotosViewController.swift @@ -2,7 +2,7 @@ import UIKit @objc(MWMPhotosViewController) final class PhotosViewController: MWMViewController { - var referenceViewForPhotoWhenDismissingHandler: ((GalleryItemModel) -> UIView?)? + @objc var referenceViewForPhotoWhenDismissingHandler: ((GalleryItemModel) -> UIView?)? private let pageViewController = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal, options: [UIPageViewControllerOptionInterPageSpacingKey: 16.0]) private(set) var photos: GalleryModel @@ -30,7 +30,7 @@ final class PhotosViewController: MWMViewController { return currentPhotoViewController?.photo } - init(photos: GalleryModel, initialPhoto: GalleryItemModel? = nil, referenceView: UIView? = nil) { + @objc init(photos: GalleryModel, initialPhoto: GalleryItemModel? = nil, referenceView: UIView? = nil) { self.photos = photos super.init(nibName: nil, bundle: nil) initialSetupWithInitialPhoto(initialPhoto) diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/PlacePageTaxiCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/PlacePageTaxiCell.swift index 0346cd81cb..5d03bcaf20 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/PlacePageTaxiCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/TaxiCell/PlacePageTaxiCell.swift @@ -1,6 +1,5 @@ @objc(MWMPlacePageTaxiCell) final class PlacePageTaxiCell: MWMTableViewCell { - @IBOutlet private weak var icon: UIImageView! @IBOutlet private weak var title: UILabel! { didSet { @@ -8,6 +7,7 @@ final class PlacePageTaxiCell: MWMTableViewCell { title.textColor = UIColor.blackPrimaryText() } } + @IBOutlet private weak var orderButton: UIButton! { didSet { let l = orderButton.layer @@ -24,7 +24,7 @@ final class PlacePageTaxiCell: MWMTableViewCell { private weak var delegate: MWMPlacePageButtonsProtocol! private var type: MWMPlacePageTaxiProvider! - func config(type: MWMPlacePageTaxiProvider, delegate: MWMPlacePageButtonsProtocol) { + @objc func config(type: MWMPlacePageTaxiProvider, delegate: MWMPlacePageButtonsProtocol) { self.delegate = delegate self.type = type switch type { diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCSelectImpressionCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCSelectImpressionCell.swift index e679213eef..9f43e5d59d 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCSelectImpressionCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCSelectImpressionCell.swift @@ -3,7 +3,7 @@ final class UGCSelectImpressionCell: MWMTableViewCell { @IBOutlet private var buttons: [UIButton]! private weak var delegate: MWMPlacePageButtonsProtocol? - func configWith(delegate: MWMPlacePageButtonsProtocol?) { + @objc func configWith(delegate: MWMPlacePageButtonsProtocol?) { self.delegate = delegate } diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCSpecificReviewCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCSpecificReviewCell.swift index ab642cbb1d..748edef9a2 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCSpecificReviewCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCSpecificReviewCell.swift @@ -10,7 +10,7 @@ final class UGCSpecificReviewCell: MWMTableViewCell { private var indexPath: NSIndexPath = NSIndexPath() private var delegate: UGCSpecificReviewDelegate? - func configWith(specification: String, rate: Int, atIndexPath: NSIndexPath, delegate: UGCSpecificReviewDelegate?) { + @objc func configWith(specification: String, rate: Int, atIndexPath: NSIndexPath, delegate: UGCSpecificReviewDelegate?) { self.specification.text = specification self.delegate = delegate indexPath = atIndexPath diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCTextReviewCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCTextReviewCell.swift index 59800d9d0a..189260a4d0 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCTextReviewCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCTextReviewCell.swift @@ -14,7 +14,7 @@ final class UGCTextReviewCell: MWMTableViewCell, UITextViewDelegate { private weak var delegate: UGCTextReviewDelegate? private var indexPath: NSIndexPath = NSIndexPath() - func configWith(delegate: UGCTextReviewDelegate?) { + @objc func configWith(delegate: UGCTextReviewDelegate?) { self.delegate = delegate setCount(textView.text.characters.count) } diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/ViatorCells/PPViatorCarouselCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/ViatorCells/PPViatorCarouselCell.swift index 3e60991842..707e9591f2 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/ViatorCells/PPViatorCarouselCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/ViatorCells/PPViatorCarouselCell.swift @@ -23,7 +23,7 @@ final class PPViatorCarouselCell: MWMTableViewCell { fileprivate var statisticsParameters: [AnyHashable: Any] { return [kStatProvider: kStatViator] } - func config(with ds: [ViatorItemModel], delegate d: MWMPlacePageButtonsProtocol?) { + @objc func config(with ds: [ViatorItemModel], delegate d: MWMPlacePageButtonsProtocol?) { if ds.isEmpty { Statistics.logEvent(kStatPlacepageSponsoredError, withParameters: statisticsParameters) } diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/ViatorCells/ViatorItemModel.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/ViatorCells/ViatorItemModel.swift index 15271602d1..4d60cbbb14 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/ViatorCells/ViatorItemModel.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/ViatorCells/ViatorItemModel.swift @@ -7,7 +7,7 @@ final class ViatorItemModel: NSObject { let duration: String let price: String - init(imageURL: URL, pageURL: URL, title: String, rating: Double, duration: String, price: String) { + @objc init(imageURL: URL, pageURL: URL, title: String, rating: Double, duration: String, price: String) { self.imageURL = imageURL self.pageURL = pageURL self.title = title diff --git a/iphone/Maps/UI/Search/Filters/FilterCollectionHolderCell.swift b/iphone/Maps/UI/Search/Filters/FilterCollectionHolderCell.swift index 7fda6f354a..0272b25b2b 100644 --- a/iphone/Maps/UI/Search/Filters/FilterCollectionHolderCell.swift +++ b/iphone/Maps/UI/Search/Filters/FilterCollectionHolderCell.swift @@ -1,6 +1,5 @@ @objc(MWMFilterCollectionHolderCell) final class FilterCollectionHolderCell: MWMTableViewCell { - @IBOutlet weak var collectionView: UICollectionView! @IBOutlet private weak var collectionViewHeight: NSLayoutConstraint! private weak var tableView: UITableView? @@ -22,7 +21,7 @@ final class FilterCollectionHolderCell: MWMTableViewCell { collectionViewHeight.constant = collectionView.contentSize.height } - func config(tableView: UITableView?) { + @objc func config(tableView: UITableView?) { layout() collectionView.allowsMultipleSelection = true isSeparatorHidden = true diff --git a/iphone/Maps/UI/Settings/Cells/SettingsTableViewLinkCell.swift b/iphone/Maps/UI/Settings/Cells/SettingsTableViewLinkCell.swift index 3ad55e6f34..3a3093b2ea 100644 --- a/iphone/Maps/UI/Settings/Cells/SettingsTableViewLinkCell.swift +++ b/iphone/Maps/UI/Settings/Cells/SettingsTableViewLinkCell.swift @@ -1,9 +1,9 @@ -@objc final class SettingsTableViewLinkCell: MWMTableViewCell { - +@objc +final class SettingsTableViewLinkCell: MWMTableViewCell { @IBOutlet fileprivate weak var title: UILabel! @IBOutlet fileprivate weak var info: UILabel! - func config(title: String, info: String?) { + @objc func config(title: String, info: String?) { backgroundColor = UIColor.white() self.title.text = title diff --git a/iphone/Maps/UI/Settings/Cells/SettingsTableViewSelectableCell.swift b/iphone/Maps/UI/Settings/Cells/SettingsTableViewSelectableCell.swift index 654dfdf1bb..6b1274b09c 100644 --- a/iphone/Maps/UI/Settings/Cells/SettingsTableViewSelectableCell.swift +++ b/iphone/Maps/UI/Settings/Cells/SettingsTableViewSelectableCell.swift @@ -1,8 +1,8 @@ -@objc final class SettingsTableViewSelectableCell: MWMTableViewCell { - +@objc +final class SettingsTableViewSelectableCell: MWMTableViewCell { @IBOutlet fileprivate weak var title: UILabel! - func config(title: String) { + @objc func config(title: String) { backgroundColor = UIColor.white() self.title.text = title diff --git a/iphone/Maps/UI/Settings/Cells/SettingsTableViewSwitchCell.swift b/iphone/Maps/UI/Settings/Cells/SettingsTableViewSwitchCell.swift index 8dd850ad90..6db78ca48e 100644 --- a/iphone/Maps/UI/Settings/Cells/SettingsTableViewSwitchCell.swift +++ b/iphone/Maps/UI/Settings/Cells/SettingsTableViewSwitchCell.swift @@ -1,10 +1,10 @@ -@objc protocol SettingsTableViewSwitchCellDelegate { - +@objc +protocol SettingsTableViewSwitchCellDelegate { func switchCell(_ cell: SettingsTableViewSwitchCell, didChangeValue value: Bool) } -@objc final class SettingsTableViewSwitchCell: MWMTableViewCell { - +@objc +final class SettingsTableViewSwitchCell: MWMTableViewCell { @IBOutlet fileprivate weak var title: UILabel! @IBOutlet fileprivate weak var switchButton: UISwitch! { didSet { @@ -14,7 +14,7 @@ weak var delegate: SettingsTableViewSwitchCellDelegate? - func config(delegate: SettingsTableViewSwitchCellDelegate, title: String, isOn: Bool) { + @objc func config(delegate: SettingsTableViewSwitchCellDelegate, title: String, isOn: Bool) { backgroundColor = UIColor.white() self.delegate = delegate diff --git a/iphone/Maps/UI/Storyboard/Storyboard.swift b/iphone/Maps/UI/Storyboard/Storyboard.swift index 0f7de7cc89..5f84db26a2 100644 --- a/iphone/Maps/UI/Storyboard/Storyboard.swift +++ b/iphone/Maps/UI/Storyboard/Storyboard.swift @@ -12,8 +12,7 @@ enum Storyboard: Int { } extension UIStoryboard { - - static func instance(_ id: Storyboard) -> UIStoryboard { + @objc static func instance(_ id: Storyboard) -> UIStoryboard { let name: String switch id { case .authorization: name = "Authorization" diff --git a/iphone/Maps/UI/Welcome/WelcomePageController.swift b/iphone/Maps/UI/Welcome/WelcomePageController.swift index afa15d1093..11495f1076 100644 --- a/iphone/Maps/UI/Welcome/WelcomePageController.swift +++ b/iphone/Maps/UI/Welcome/WelcomePageController.swift @@ -33,7 +33,7 @@ final class WelcomePageController: UIPageViewController { } } - static func controller(parent: WelcomePageControllerProtocol) -> WelcomePageController? { + @objc static func controller(parent: WelcomePageControllerProtocol) -> WelcomePageController? { let isFirstSession = Alohalytics.isFirstSession() let welcomeKey = isFirstSession ? FirstLaunchController.key : WhatsNewController.key guard UserDefaults.standard.bool(forKey: welcomeKey) == false else { return nil } diff --git a/iphone/Maps/UI/Welcome/WelcomeProtocol.swift b/iphone/Maps/UI/Welcome/WelcomeProtocol.swift index 131908ec6d..9a2c16eea8 100644 --- a/iphone/Maps/UI/Welcome/WelcomeProtocol.swift +++ b/iphone/Maps/UI/Welcome/WelcomeProtocol.swift @@ -39,7 +39,7 @@ extension WelcomeProtocolBase { let size = pageController.view!.size let (width, height) = (size.width, size.height) let hideImage = (imageHeight.multiplier * height <= imageMinHeight.constant) - titleImageOffset.priority = hideImage ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh + titleImageOffset.priority = hideImage ? UILayoutPriority.defaultLow : UILayoutPriority.defaultHigh image.isHidden = hideImage containerWidth.constant = width containerHeight.constant = height |