Skip to content
Permalink
Browse files

Fix height when iphone x series

  • Loading branch information...
k-lpmg committed May 9, 2019
1 parent b45536a commit 1bc3d67345708c466114069181f3e97d6b2cce79
Showing with 12 additions and 1 deletion.
  1. +12 −1 Sources/AwaitToast/Operations/ToastOperation.swift
@@ -79,7 +79,18 @@ class ToastOperation<A, B>: Operation where A: ToastAppearance, B: ToastBehavior
if view.appearance.height == AutomaticDimension {
view.heightAnchor.constraint(greaterThanOrEqualToConstant: 0).isActive = true
} else {
view.heightAnchor.constraint(equalToConstant: view.appearance.height).isActive = true
let safeAreaPadding: CGFloat
switch view.direction {
case .top:
safeAreaPadding = UIApplication.shared.statusBarFrame.size.height
case .bottom:
if #available(iOS 11.0, *), let window = UIApplication.shared.keyWindow {
safeAreaPadding = window.safeAreaInsets.bottom
} else {
safeAreaPadding = 0
}
}
view.heightAnchor.constraint(equalToConstant: view.appearance.height + safeAreaPadding).isActive = true
}

let initialViewYAnchor: NSLayoutConstraint

0 comments on commit 1bc3d67

Please sign in to comment.
You can’t perform that action at this time.