Skip to content

Instantly share code, notes, and snippets.


Mariano Abdala marianoabdala

View GitHub Profile
marianoabdala / UIViewController+SafeAreaLayoutGuide.swift
Created April 16, 2018 19:49 — forked from fedetrim/UIViewController+SafeAreaLayoutGuide.swift
Backwards compatible Safe Area Layout Guide API for iOS 10 and iOS 9
View UIViewController+SafeAreaLayoutGuide.swift
import UIKit
extension UIViewController {
var ft_safeAreaLayoutGuide: UILayoutGuide {
if #available(iOS 11.0, *) {
return view.safeAreaLayoutGuide
} else {
let id = "ft_safeAreaLayoutGuide"

Keybase proof

I hereby claim:

  • I am marianoabdala on github.
  • I am marianoabdala ( on keybase.
  • I have a public key whose fingerprint is 0CA2 71D2 DA79 21E0 5483 A477 23D6 68AB 1A5A AB48

To claim this, I am signing this object:

- (void)saveScreenshotToDocumentsDirectory
CGSize imageSize = [[UIScreen mainScreen] bounds].size;
if (NULL != UIGraphicsBeginImageContextWithOptions)
UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0);
else UIGraphicsBeginImageContext(imageSize);
CGContextRef context = UIGraphicsGetCurrentContext();
for (UIWindow *window in [[UIApplication sharedApplication] windows]) {
if (![window respondsToSelector:@selector(screen)] || [window screen] == [UIScreen mainScreen]) {