Skip to content

Instantly share code, notes, and snippets.

@douglashill
douglashill / updateSafeAreaForKeyboardFromNotification.swift
Last active June 25, 2023 16:11
Avoid the keyboard by leveraging additionalSafeAreaInsets.
// Avoids the keyboard in a UIKit app by leveraging additionalSafeAreaInsets.
// You can put this in the root view controller so the whole app will avoid the keyboard.
// Only tested on iOS 13.3.
// Made for https://douglashill.co/reading-app/
@objc func updateSafeAreaForKeyboardFromNotification(_ notification: Notification) {
guard let endFrameInScreenCoords = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect else {
return
}
// Please consider whether the force unwrap here is safe for your own use case.
@JaviSoto
JaviSoto / gist:6090085
Created July 26, 2013 16:06
Dynamic row height calculation in table view with cells implemented with nib + autolayout
//
// JSDynamicRowHeightTableViewController.h
//
// Created by Javier Soto on 7/25/13.
// Copyright (c) 2013 JavierSoto. All rights reserved.
//
#import <UIKit/UIKit.h>
/**