This file contains hidden or 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
{ | |
1.6.11: "https://kit-downloads.fabric.io/ios/io.fabric.sdk.ios/1.6.11/io.fabric.sdk.ios-default.zip" | |
} |
This file contains hidden or 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
#!/bin/sh | |
# CoreText.framework is missing for the watchOS Simulator (but is available on the device platform SDK) | |
# https://openradar.appspot.com/27844864 | |
# | |
# This script is a quick patch to solve this issue, so we are all capable of running CoreText APIs on the Watch simulator too, | |
# by copying the WatchOS SDK's CoreText header files into the WatchSimulator's. This works great, although since editing the SDK files | |
# is protected, it needs to be run with sudo. | |
# Returns the appropriate platform path containing the framework headers |
This file contains hidden or 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
+ (UIViewController *)topPresentedViewController | |
{ | |
UIAppDelegate *delegate = [UIApplication sharedApplication].delegate; | |
UIViewController *visibleViewController = delegate.keyWindow.rootViewController; | |
while (visibleViewController.presentedViewController) { | |
visibleViewController = visibleViewController.presentedViewController; | |
} | |
This file contains hidden or 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
/* | |
* This is an example provided by Facebook are for non-commercial testing and | |
* evaluation purposes only. | |
* | |
* Facebook reserves all rights not expressly granted. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL | |
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
This file contains hidden or 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
NSArray *sorted = [[dict allValues] sortedArrayUsingComparator:^NSComparisonResult(UIColor* obj1, UIColor* obj2) { | |
float hue, saturation, brightness, alpha; | |
[obj1 getHue:&hue saturation:&saturation brightness:&brightness alpha:&alpha]; | |
float hue2, saturation2, brightness2, alpha2; | |
[obj2 getHue:&hue2 saturation:&saturation2 brightness:&brightness2 alpha:&alpha2]; | |
if (hue < hue2) | |
return NSOrderedAscending; | |
else if (hue > hue2) | |
return NSOrderedDescending; |
This file contains hidden or 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
- (NSArray *)rangesInSubstring:(NSString *)substring | |
{ | |
NSError *error = NULL; | |
NSString *regex = [NSString stringWithFormat:@"\\b%@", substring]; | |
NSRegularExpression *regExpression = [NSRegularExpression regularExpressionWithPattern:regex options:NSRegularExpressionCaseInsensitive error:&error]; | |
NSMutableArray *ranges = [NSMutableArray array]; | |
NSArray *matches = [regExpression matchesInString:self options:NSRegularExpressionSearch range:NSMakeRange(0, self.length)]; |
This file contains hidden or 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 "NSObject+SmartDescription.h" | |
#import <objc/runtime.h> | |
@implementation NSObject (SmartDescription) | |
- (NSString *)smartDescription | |
{ | |
NSMutableString *string = [NSMutableString stringWithFormat:@"<%@: %p> ", NSStringFromClass([self class]), self]; | |
NSDictionary *properties = [self propertyList]; | |
This file contains hidden or 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
- (UIViewController *)appropriatePresentationViewController | |
{ | |
UIViewController *rootviewController = [UIApplication sharedApplication].keyWindow.rootViewController; | |
return rootviewController.presentedViewController ? : rootviewController; | |
} |
This file contains hidden or 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
NSString *sourceString = [[NSThread callStackSymbols] objectAtIndex:1]; | |
// Example: 1 UIKit 0x00540c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163 | |
NSCharacterSet *separatorSet = [NSCharacterSet characterSetWithCharactersInString:@" -[]+?.,"]; | |
NSMutableArray *array = [NSMutableArray arrayWithArray:[sourceString componentsSeparatedByCharactersInSet:separatorSet]]; | |
[array removeObject:@""]; | |
NSLog(@"Stack = %@", [array objectAtIndex:0]); | |
NSLog(@"Framework = %@", [array objectAtIndex:1]); | |
NSLog(@"Memory address = %@", [array objectAtIndex:2]); | |
NSLog(@"Class caller = %@", [array objectAtIndex:3]); |