Skip to content

Commit ecfe4a0

Browse files
committed
Fixed indentation, UIScreen
1 parent 3f2cf4f commit ecfe4a0

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Sources/BarcodeScannerController.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ open class BarcodeScannerController: UIViewController {
265265
*/
266266
func setupSession() {
267267
guard let captureDevice = captureDevice else {
268-
return
268+
return
269269
}
270270

271271
do {
@@ -326,19 +326,21 @@ open class BarcodeScannerController: UIViewController {
326326
func setupFrame() {
327327
let flashButtonSize: CGFloat = 37
328328
let isLandscape = view.frame.width > view.frame.height
329-
let isIphoneX = UIDevice().userInterfaceIdiom == .phone && UIScreen.main.nativeBounds.height == 2436
329+
330330
var rightSafeAreaInset: CGFloat = 0
331+
var topSafeAreaInset: CGFloat = 0
332+
if #available(iOS 11.0, *) {
333+
rightSafeAreaInset = view.safeAreaInsets.right
334+
topSafeAreaInset = view.safeAreaInsets.top
335+
}
331336

332337
var navbarSize: CGFloat = 0
333338
if (isLandscape) {
334-
navbarSize = 32
339+
navbarSize = 32
335340
}
336341
else {
337-
navbarSize = isIphoneX ? 88 : 64
338-
}
339-
340-
if #available(iOS 11.0, *) {
341-
rightSafeAreaInset = view.safeAreaInsets.right
342+
// On iPhone X devices, extend the size of the top nav bar
343+
navbarSize = topSafeAreaInset > 0 ? 88 : 64
342344
}
343345

344346
headerView.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: navbarSize)

0 commit comments

Comments
 (0)