WWDC 2006 2007 2008 2009 2010 2011 2012 2013 2014
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
KeyboardAvoidingWithOffset() | |
.keyboardHeightEnvironmentValue() | |
} | |
} | |
struct KeyboardAvoidingWithOffset: View { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import Vision | |
import AVFoundation | |
import Foundation | |
class ScanViewController: UIViewController { | |
private lazy var cameraPreviewLayer: AVCaptureVideoPreviewLayer = { | |
let l = AVCaptureVideoPreviewLayer(session: captureSession) | |
l.videoGravity = .resizeAspectFill | |
l.connection?.videoOrientation = .portrait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CoreData | |
import Foundation | |
/// Safely copies the specified `NSPersistentStore` to a temporary file. | |
/// Useful for backups. | |
/// | |
/// - Parameter index: The index of the persistent store in the coordinator's | |
/// `persistentStores` array. Passing an index that doesn't exist will trap. | |
/// | |
/// - Returns: The URL of the backup file, wrapped in a TemporaryFile instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <objc/runtime.h> | |
@interface DebuggingOverlay: NSObject | |
@end | |
@implementation DebuggingOverlay | |
+ (void)toggleOverlay { | |
id debugInfoClass = NSClassFromString(@"UIDebuggingInformationOverlay"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SpinlockTestTests.swift | |
// SpinlockTestTests | |
// | |
// Created by Peter Steinberger on 04/10/2016. | |
// Copyright © 2016 PSPDFKit GmbH. All rights reserved. | |
// | |
import XCTest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// YPLayoutGuideHelper.m | |
// | |
// Created by Yuya Tanaka, 2015 | |
// | |
// This is free and unencumbered software released into the public domain. | |
// Refer: http://unlicense.org/ | |
// | |
// automaticallyAdjustsScrollViewInsets doesn't work for child view controllers | |
// hosted by something like Container View or UIPageViewController. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// these functions take a swift class's statically referenced method and the instance those methods | |
// should apply to, and returns a function that weakly captures the instance so that you don't have | |
// to worry about memory retain cycles if you want to directly use an instance method as a handler | |
// for some object, like NSNotificationCenter. | |
// | |
// For more information, see this post: | |
// http://www.klundberg.com/blog/capturing-objects-weakly-in-instance-method-references-in-swift/ | |
func weakify <T: AnyObject, U>(owner: T, f: T->U->()) -> U -> () { | |
return { [weak owner] obj in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
du -h / | sort -n | grep -E '^(\d+?| \d+?|\d,\d)G' |
NewerOlder