From 6021f612eb445e3b8ecb647ec8ad85ec303ebce6 Mon Sep 17 00:00:00 2001 From: youjinp Date: Thu, 21 Nov 2019 07:45:32 +1300 Subject: [PATCH] Fix: issue #13 (#14) * Fix: issue #13 `UIDevice.current.orientation` gives "unknown" orientation Change to use width and height to determine whether landscape or portrait * Refactor --- Sources/WaterfallGrid/GridSyle.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/WaterfallGrid/GridSyle.swift b/Sources/WaterfallGrid/GridSyle.swift index 53313ca..f7d0a39 100644 --- a/Sources/WaterfallGrid/GridSyle.swift +++ b/Sources/WaterfallGrid/GridSyle.swift @@ -21,7 +21,8 @@ struct GridSyle { #elseif os(watchOS) return columnsInPortrait #else - return UIDevice.current.orientation.isLandscape ? columnsInLandscape : columnsInPortrait + let screenSize = UIScreen.main.bounds.size + return screenSize.width > screenSize.height ? columnsInLandscape : columnsInPortrait #endif } }