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
i386 : iPhone Simulator | |
x86_64 : iPhone Simulator | |
arm64 : iPhone Simulator | |
iPhone1,1 : iPhone | |
iPhone1,2 : iPhone 3G | |
iPhone2,1 : iPhone 3GS | |
iPhone3,1 : iPhone 4 | |
iPhone3,2 : iPhone 4 GSM Rev A | |
iPhone3,3 : iPhone 4 CDMA | |
iPhone4,1 : iPhone 4S |
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
// http://cocoawithlove.com/2009/10/ugly-side-of-blocks-explicit.html has a nice breakdown of the syntax--it helps to think of the ^ as similar to a pointer dereference symbol * | |
// block typedef: | |
typedef void(^Block)(); | |
typedef void(^ConditionalBlock)(BOOL); | |
typedef NSString*(^BlockThatReturnsString)(); | |
typedef NSString*(^ConditionalBlockThatReturnsString)(BOOL); | |
// block property with typedef: |
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
// Taken from the commercial iOS PDF framework http://pspdfkit.com. | |
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved. | |
// Licensed under MIT (http://opensource.org/licenses/MIT) | |
// | |
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it. | |
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit. | |
#import <objc/runtime.h> | |
#import <objc/message.h> |
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
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { | |
// Horrible HACK for bug in UITextView where it won't scroll to the new line after pressing enter in the text view. | |
// I feel dirty for having to write this. Buggy at least within iOS 7.0 - 7.1b1. | |
if (PSPDFIsUIKitFlatMode() && [text isEqualToString:@"\n"] && range.location == textView.text.length) { | |
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)); | |
dispatch_after(popTime, dispatch_get_main_queue(), ^{ | |
CGPoint contentOffset = textView.contentOffset; | |
CGFloat fontSize = textView.font.pointSize; | |
if (textView.contentSize.height - fontSize > textView.bounds.size.height) { | |
contentOffset.y += fontSize + 2.f; // add spacing |
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
/** | |
Provides the ability to verify key paths at compile time. | |
If "keyPath" does not exist, a compile-time error will be generated. | |
Example: | |
// Verifies "isFinished" exists on "operation". | |
NSString *key = SQKeyPath(operation, isFinished); | |
// Verifies "isFinished" exists on self. |
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
- (void)viewDidLayoutSubviews | |
{ | |
[super viewDidLayoutSubviews]; | |
self.imageView.layer.masksToBounds = YES; | |
self.imageView.layer.cornerRadius = self.imageView.bounds.size.width / 2.; | |
} |
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/objc-runtime.h> | |
#import "UIView+SGAutoLayoutExtensions.h" | |
@implementation UIView (SGAutoLayoutExtensions) | |
#ifdef DEBUG | |
- (NSString *)nsli_description | |
{ | |
return [self restorationIdentifier] ?: [NSString stringWithFormat:@"%@:%p", [self class], self]; |
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
operator infix --> {} | |
func --> (instance: Any, key: String) -> Any? { | |
let mirror = reflect(instance) | |
for index in 0 ..< mirror.count { | |
let (childKey, childMirror) = mirror[index] | |
if childKey == key { | |
return childMirror.value | |
} | |
} |
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
Project | # of Top 100 Free Apps (US) | |
---|---|---|
facebook-ios-sdk | 67 | |
Bolts-iOS | 48 | |
AFNetworking | 39 | |
Google-Mobile-Ads-SDK | 38 | |
Reachability (Apple) | 38 | |
Crashlytics | 37 | |
Flurry-iOS-SDK | 31 | |
CocoaPods | 30 | |
GoogleConversionTracking | 29 |
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 Cocoa | |
// for-in | |
func checkForIn(array: [Int], dict: [Int: String]) { | |
for num in array where dict[num] != nil { | |
num | |
} | |
} | |
checkForIn([1,2,3,4], dict: [1:"one", 2:"two"]) |
OlderNewer