Skip to content

Instantly share code, notes, and snippets.

View futuretap's full-sized avatar

Ortwin Gentz, FutureTap futuretap

View GitHub Profile
@mackuba
mackuba / core_data_wwdc.json
Last active January 26, 2024 11:41
List of all WWDC talks about Core Data since 2010
[
{
"id": "wwdc2010-118",
"title": "Mastering Core Data",
"description": "Core Data contains a vast set of advanced features to help you better manage your data and evolve your application over time. Master the techniques for working with data in your application, from being more efficient to doing more in the database and changing how you store your data over time. Take your Core Data knowledge to the next level.",
"links": [
[
"HD",
"https://developer.apple.com/devcenter/download.action?path=/videos/wwdc_2010__hd/session_118__mastering_core_data.mov"
],
@nicolas-miari
nicolas-miari / UIBezierPath+Superellipsoid
Created August 29, 2019 01:10
UIBezierPath extension to draw a 'squircle' (superellipsoid) of arbitrary size and "corner radius"
import UIKit
extension UIBezierPath {
/**
Draws the super-elliptic analog of a rounded rect. Unlike the regular rounded rect, the rounded corners
are the quadrants of a superellipse (i.e., parabolic segments), _not_ circular arcs.
If `rect` is a square and `cornerRadius` is equal to half the length or more, and actual superellipse is
drawn (no straight sections along its boundary) just like doing the same with a rounded rect results in a
circle being drawn.
@mayoff
mayoff / !README.md
Last active August 14, 2023 15:09
Debugging Objective-C blocks in lldb

The attached lldb command pblock command lets you peek inside an Objective-C block. It tries to tell you where to find the source code for the block, and the values captured by the block when it was created.

Consider this example program:

#import <Foundation/Foundation.h>

@interface Foo: NSObject
@end

@implementation Foo

@smileyborg
smileyborg / InteractiveTransitionCollectionViewDeselection.m
Last active January 15, 2023 13:03
Animate table & collection view deselection alongside interactive transition (for iOS 11 and later)
// UICollectionView Objective-C example
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject];
if (selectedIndexPath != nil) {
id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator;
if (coordinator != nil) {
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
As of iOS 11/macOS High Sierra, and only including ones in Foundation and CoreFoundation
Strings:
_NSCFString - a CFStringRef or CFMutableStringRef. This is the most common type of string object currently.
- May have 8 bit (ASCII) or 16 bit (UTF-16) backing store
_NSCFConstantString - a compile time constant CFStringRef, like you'd get with @"foo"
- May also be generated by dynamic string creation if matches a string in a pre-baked table of common strings called the StringROM
NSBigMutableString - an NSString backed by a CFStorage (https://github.com/opensource-apple/CF/blob/master/CFStorage.h) for faster handling of very large strings
NSCheapMutableString - a very limited NSMutableString that allows for zero-copy initialization. Used in NSFileManager for temporarily wrapping stack buffers.
@frankrausch
frankrausch / String+Hyphenation.swift
Last active June 15, 2023 16:45
Returns a String with soft hyphens (U+00AD)
import Foundation
extension String {
func hyphenated(languageCode: String) -> String {
let locale = Locale(identifier: languageCode)
return self.hyphenated(locale: locale)
}
func hyphenated(locale: Locale) -> String {
@0xced
0xced / Emoji-iOS-10.0-14A5322e.json
Created August 8, 2016 22:38
Emoji from iOS beta 4 (14A5322e)
{
"People" : [
{
"Symbol" : "😀",
"Name" : "GRINNING FACE"
},
{
"Symbol" : "😬",
"Name" : "GRIMACING FACE"
},
@travisnewby
travisnewby / CMDeviceMotion.swift
Last active November 12, 2022 17:13
Determine the direction of "gaze" of the device in any orientation
extension CMDeviceMotion {
func gaze(atOrientation orientation: UIInterfaceOrientation) -> SCNVector4 {
let attitude = self.attitude.quaternion
let aq = GLKQuaternionMake(Float(attitude.x), Float(attitude.y), Float(attitude.z), Float(attitude.w))
let final: SCNVector4
switch orientation {
@jverkoey
jverkoey / Dictionary+GetWithDefault.swift
Last active November 5, 2015 09:11
Swift Dictionary get-with-default extension
import Foundation
extension Dictionary {
/**
Returns the value for the given key if it exists, otherwise stores and returns the result of
withDefault.
Example usage:
var dictionary: [String:[String]] = [:]
@nickfrey
nickfrey / WFSimulate3DTouchPreview.m
Created September 22, 2015 20:13
Test 3D Touch peek/pop using private APIs
@interface UIPreviewForceInteractionProgress : NSObject
- (void)endInteraction:(BOOL)arg1;
@end
@interface UIPreviewInteractionController : NSObject
@property (nonatomic, readonly) UIPreviewForceInteractionProgress *interactionProgressForPresentation;