Skip to content

Instantly share code, notes, and snippets.

{
"3.0.3" : "https://www.gstatic.com/cpdc/8f4d85570fdd4ab9-Google-3.0.3.tar.gz"
}
class DoTaskClass {
let identifier: String
init(identifier: String) {
self.identifier = identifier
}
func getTask() -> (() -> ()) {
return { [weak self] in
Compile Swift Module 'ExampleProject' (1 sources)
Linking ./.build/x86_64-unknown-linux/release/ExampleProject
/usr/bin/ld.gold: Opened new descriptor 3 for "//usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/Scrt1.o"
/usr/bin/ld.gold: Attempt to open //usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/Scrt1.o succeeded
/usr/bin/ld.gold: Unlocking file "//usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/Scrt1.o"
/usr/bin/ld.gold: Released descriptor 3 for "//usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/Scrt1.o"
/usr/bin/ld.gold: Opened new descriptor 7 for "//usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crti.o"
/usr/bin/ld.gold: Attempt to open //usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crti.o succeeded
/usr/bin/ld.gold: Unlocking file "//usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crti.o"
/usr/bin/ld.gold: Released descriptor 7 for "//usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crti.o"
#!/bin/bash
if [ $# -lt 2 ]; then
echo "format: git_cleanup <repo name> [-x/--expunge <directory 1> -l/--keeplatest <directory 2> ...]"
exit
fi
PROJ="$1"
shift
UIResponder.keyboardWillShowNotification
UIResponder.keyboardDidShowNotification
UIResponder.keyboardWillHideNotification
UIResponder.keyboardDidHideNotification
UIKeyboardAnimationCurveUserInfoKey: 7
UIKeyboardAnimationDurationUserInfoKey: 0.25
UIKeyboardBoundsUserInfoKey: NSRect: {{0, 0}, {820, 337}}
UIKeyboardCenterBeginUserInfoKey: NSPoint: {410, 1319.5}
UIKeyboardCenterEndUserInfoKey: NSPoint: {410, 1011.5}
UIKeyboardFrameBeginUserInfoKey: NSRect: {{0, 1180}, {820, 279}}
UIKeyboardFrameEndUserInfoKey: NSRect: {{0, 843}, {820, 337}}
UIKeyboardIsLocalUserInfoKey: 1
class ViewController: UIViewController {
//Register for notification ...
private func addjustSafeAreaTo(keyboardFrame: CGRect) {
view.safeAreaInsets.bottom = keyboardFrame.height
}
}
class KeyboardAppearListener {
private var showKeyboard: NotificationToken?
private var hideKeyboard: NotificationToken?
private weak var viewController: UIViewController?
init(
_ viewController: UIViewController,
notificationCenter: NotificationCenter = .default) {
self.viewController = viewController
showKeyboard = notificationCenter.observe(
name: UIResponder.keyboardWillShowNotification) { [weak self] (notification) in
guard
let viewController = viewController,
let userInfo = notification.userInfo,
let beginKeyboardFrame = userInfo[UIResponder.keyboardFrameBeginUserInfoKey] as? CGRect,
let endKeyboardFrame = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect,
endKeyboardFrame != beginKeyboardFrame
else {
return
}
viewController.additionalSafeAreaInsets.bottom += beginKeyboardFrame.origin.y - endKeyboardFrame.origin.y