<commit_before>#import "MWMiPhoneRoutePreview.h"
#import "MWMCommon.h"
#import "SwiftBridge.h"

@interface MWMRoutePreview ()

@property(nonatomic) BOOL isVisible;

@end

@interface MWMiPhoneRoutePreview ()
@property(weak, nonatomic) IBOutlet UIButton * backButton;
@property(nonatomic) NSLayoutConstraint * verticalConstraint;
@end

@implementation MWMiPhoneRoutePreview

- (void)setupConstraints
{
  auto sv = self.superview;
  [self.leadingAnchor constraintEqualToAnchor:sv.leadingAnchor].active = YES;
  [self.trailingAnchor constraintEqualToAnchor:sv.trailingAnchor].active = YES;
  self.verticalConstraint = [self.bottomAnchor constraintEqualToAnchor:sv.topAnchor];
  self.verticalConstraint.active = YES;

  NSLayoutXAxisAnchor * backLeadingAnchor = sv.leadingAnchor;
  if (@available(iOS 11.0, *))
  {
    backLeadingAnchor = sv.safeAreaLayoutGuide.leadingAnchor;
  }
  [self.backButton.leadingAnchor constraintEqualToAnchor:backLeadingAnchor].active = YES;
}

- (void)setIsVisible:(BOOL)isVisible
{
  self.verticalConstraint.active = NO;
  auto sv = self.superview;
  NSLayoutYAxisAnchor * topAnchor = sv.topAnchor;
  NSLayoutYAxisAnchor * selfAnchor = isVisible ? self.topAnchor : self.bottomAnchor;
  CGFloat constant = 0;
  if (isVisible)
  {
    if (@available(iOS 11.0, *))
    {
      topAnchor = sv.safeAreaLayoutGuide.topAnchor;
    }
    else
    {
      constant = statusBarHeight();
    }
  }<commit_msg>[iphonex] [ios] Fixed crash.<commit_after>#import "MWMiPhoneRoutePreview.h"
#import "MWMCommon.h"
#import "SwiftBridge.h"

@interface MWMRoutePreview ()

@property(nonatomic) BOOL isVisible;

@end

@interface MWMiPhoneRoutePreview ()
@property(weak, nonatomic) IBOutlet UIButton * backButton;
@property(nonatomic) NSLayoutConstraint * verticalConstraint;
@end

@implementation MWMiPhoneRoutePreview

- (void)setupConstraints
{
  auto sv = self.superview;
  [self.leadingAnchor constraintEqualToAnchor:sv.leadingAnchor].active = YES;
  [self.trailingAnchor constraintEqualToAnchor:sv.trailingAnchor].active = YES;
  self.verticalConstraint = [self.bottomAnchor constraintEqualToAnchor:sv.topAnchor];
  self.verticalConstraint.active = YES;

  NSLayoutXAxisAnchor * backLeadingAnchor = sv.leadingAnchor;
  if (@available(iOS 11.0, *))
  {
    backLeadingAnchor = sv.safeAreaLayoutGuide.leadingAnchor;
  }
  [self.backButton.leadingAnchor constraintEqualToAnchor:backLeadingAnchor].active = YES;
}

- (void)setIsVisible:(BOOL)isVisible
{
  auto sv = self.superview;
  if (!sv)
    return;
  self.verticalConstraint.active = NO;
  NSLayoutYAxisAnchor * topAnchor = sv.topAnchor;
  NSLayoutYAxisAnchor * selfAnchor = isVisible ? self.topAnchor : self.bottomAnchor;
  CGFloat constant = 0;
  if (isVisible)
  {
    if (@available(iOS 11.0, *))
    {
      topAnchor = sv.safeAreaLayoutGuide.topAnchor;
    }
    else
    {
      constant = statusBarHeight();
    }
  }
{'fraction_non_alphanumeric': 0.10845460845460846, 'fraction_numerical': 0.004851004851004851, 'mean_word_length': 5.014583333333333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7325978', 'n_tokens_mistral': 947, 'n_tokens_neox': 901, 'n_words': 162}