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
range: {0, 0} | |
newString: [ㅅ] | |
original newCharCount: 1 | |
new newCharCount: 1 | |
count: 1 graphemeCount: 1 | |
range: {1, 0} | |
newString: [ㅅㅅ] | |
original newCharCount: 2 | |
new newCharCount: 2 | |
count: 1 graphemeCount: 1 |
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
- (void)textViewDidChange:(UITextView *)inTextView { | |
NSUInteger count = [[self text] length]; | |
__weak __typeof__(self) blockSelf = self; | |
if (count > self.characterLimit) { | |
NSMutableString *newString = [NSMutableString string]; | |
__block NSUInteger blockCount = 0; | |
[inTextView.text enumerateSubstringsInRange:NSMakeRange(0, [inTextView.text length]) | |
options:NSStringEnumerationByComposedCharacterSequences |
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 "CustomAnnotationView.h" | |
#import <QuartzCore/QuartzCore.h> | |
@interface CustomAnnotationView() | |
- (CAAnimation *)rotationAnimation; | |
- (CAAnimation *)scaleAnimation; | |
@end |
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
- (CLLocationCoordinate2D)locationFromLocation:(CLLocationCoordinate2D)initialLocation course:(CLLocationDirection)course distance:(CLLocationDistance)distance { | |
CLLocationCoordinate2D retValue = initialLocation; | |
static const CLLocationDistance EarthRadius = 6371000; // avg radius of the Earth in meters | |
CLLocationDegrees newLat = 0.0; | |
CLLocationDegrees newLong = 0.0; | |
newLat = asin(sin(initialLocation.latitude * M_PI/180.0) * cos(distance/EarthRadius) + | |
cos(initialLocation.latitude * M_PI/180.0) * sin(distance/EarthRadius) * cos(course * M_PI/180.0) ); | |
newLong = initialLocation.longitude * M_PI/180.0 + atan2(sin(course * M_PI/180.0) * sin(distance/EarthRadius) * cos(initialLocation.latitude * M_PI/180.0), |
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
- (void)viewDidLoad { | |
ChildViewController *cvc = [self.storyboard instantiateViewControllerWithIdentifier:@"ChildViewController"]; | |
[super viewDidLoad]; | |
[self addChildViewController:cvc]; | |
cvc.view.frame = self.containerView.bounds; | |
[self.containerView addSubview:cvc.view]; | |
[cvc didMoveToParentViewController:self]; | |
} |
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
- (void)testWeak { | |
#pragma clang diagnostic push | |
#pragma clang diagnostic ignored "-Warc-repeated-use-of-weak" | |
NSString *strong = @"foo"; | |
__weak NSString *weak = strong; | |
NSLog(@"weak: %@", weak); | |
strong = nil; | |
NSLog(@"weak: %@", weak); | |
#pragma clang diagnostic pop |
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
* | |
!.gitignore | |
!Sample.xcworkspace |
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
let mainBundle = NSBundle.mainBundle() | |
let bundle = mainBundle.pathForResource("Bundle", ofType: "bundle", inDirectory: "PlugIns") | |
println("mainBundle: \(mainBundle)") | |
println("bundle: \(bundle)") |
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
/Products/Debug/MainApp.app> find . | |
. | |
./Contents | |
./Contents/Frameworks | |
./Contents/Frameworks/Framework.framework | |
./Contents/Frameworks/Framework.framework/Framework | |
./Contents/Frameworks/Framework.framework/Headers | |
./Contents/Frameworks/Framework.framework/Modules | |
./Contents/Frameworks/Framework.framework/Resources | |
./Contents/Frameworks/Framework.framework/Versions |
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
// Playground - noun: a place where people can play | |
struct MySet<T: Hashable> : DebugPrintable { | |
var store: Dictionary<T,Void> | |
init() { | |
store = [:] | |
} |