Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save sindresorhus/e304f157e1fc2b4e63dedc151b25b583 to your computer and use it in GitHub Desktop.

Select an option

Save sindresorhus/e304f157e1fc2b4e63dedc151b25b583 to your computer and use it in GitHub Desktop.

Revisions

  1. sindresorhus revised this gist Oct 19, 2022. No changes.
  2. sindresorhus created this gist Oct 17, 2022.
    14 changes: 14 additions & 0 deletions UIScreen-screens-deprecation-warning-fix.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    private protocol SilenceDeprecationForUIScreenWindows {
    var screens: [UIScreen] { get }
    }

    private final class SilenceDeprecationForUIScreenWindowsImplementation: SilenceDeprecationForUIScreenWindows {
    @available(iOS, deprecated: 16)
    var screens: [UIScreen] { UIScreen.screens }
    }

    extension UIScreen {
    static var screens2: [UIScreen] {
    (SilenceDeprecationForUIScreenWindowsImplementation() as SilenceDeprecationForUIScreenWindows).screens
    }
    }