A block of code to distinguish the full-screen iPhone

Use a static variable

If you just want to do simple processing depending on different iPhone models, recommend the following static variable:

static var isFullScreen: Bool {
    if #available(iOS 11, *) {
        guard let w = UIApplication.shared.delegate?.window, let unwrapedWindow = w else {
            return false
        if unwrapedWindow.safeAreaInsets.left > 0 || unwrapedWindow.safeAreaInsets.bottom > 0 {
            return true
    return false

Install ScreenType by Cocoapods

ScreenType is a library to easily distinguish between iPhone models in Objective-C and Swift. And you could install it by Cocoapods.

Go to GitHub – allgamesallfree/ScreenType: Easily distinguish between iph models in Objective-C and Swift or Easily distinguish between iph models – maxste.in in order to find further explanations.


Tagged as: , ,


Fill in your details below or click an icon to log in:

WordPress.com 徽标

您正在使用您的 WordPress.com 账号评论。 注销 /  更改 )

Twitter picture

您正在使用您的 Twitter 账号评论。 注销 /  更改 )

Facebook photo

您正在使用您的 Facebook 账号评论。 注销 /  更改 )

Connecting to %s

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理