gitflow | git |
---|---|
git flow init |
git init |
git commit --allow-empty -m "Initial commit" |
|
git checkout -b develop master |
- (void)testRelativeURLs { | |
PSPDFDocument *document = [[PSPDFTestAssetLoader new] documentWithName:@"Testcase-relative-links.pdf"]; | |
NSArray *annotations = [document annotationsForPage:0 type:PSPDFAnnotationTypeLink]; | |
PSPDFLinkAnnotation *link = annotations[0]; | |
NSString *const referenceString = @"Testcase-relative-links/Simple.txt"; | |
XCTAssertEqualObjects(link.URL.absoluteString, referenceString, @"URL should be correct"); | |
PSPDFViewController *pdfController = [[PSPDFViewController alloc] initWithDocument:document]; | |
__block NSURL *showPreviewURL = nil; |
- (void)testSparkInspectorCompatibility { | |
PSPDFDocument *document = [[PSPDFTestAssetLoader new] documentWithName:@"Testcase_Metadata.pdf"]; | |
// Spark swizzles this method and calls description on the target. Let's simulate this for this test case, and then clean up. | |
id<Aspect> token = [NSNotificationCenter aspect_hookSelector:@selector(addObserver:selector:name:object:) withOptions:0 usingBlock:^(id instance, NSArray *args) { | |
[args.firstObject description]; | |
} error:NULL]; | |
// Load the document. This failed because of side effects in description when called during init. | |
UIImage *image = [document imageForPage:0 size:CGSizeMake(100, 100) clippedToRect:CGRectZero annotations:nil options:nil receipt:NULL error:NULL]; |
extension Array { | |
func first() -> Element? { | |
if isEmpty { | |
return nil | |
} | |
return self[0] | |
} | |
func last() -> Element? { |
NSString *hexString = @"1F0A7"; | |
unsigned int character; | |
NSScanner* scanner = [NSScanner scannerWithString:hexString ]; | |
[ scanner scanHexInt:&character ]; | |
UTF32Char inputChar = NSSwapHostIntToLittle(character); // swap to little-endian if necessary | |
NSString *str = [[NSString alloc] initWithBytes:&inputChar length:4 encoding:NSUTF32LittleEndianStringEncoding]; |
extension NSSet { | |
@conversion func __conversion() -> Array<AnyObject> { | |
return self.allObjects | |
} | |
} | |
func returnImmutableNSSet()-> NSSet { | |
return NSSet(array: [1,2,3,4]) | |
} |
In this article, I'm going to explore a way that we can create views that implement custom Core Animation property animations in a natural way.
As we know, layers in iOS come in two flavours: Backing layers and hosted layers. The only difference between them is that the view acts as the layer delegate for its backing layer, but not for any hosted sublayers.
In order to implement the UIView
transactional animation blocks, UIView
disables all animations by default and then re-enables them individually as required. It does this using the actionForLayer:forKey:
method.
Somewhat strangely, UIView
doesn't enable animations for every property that CALayer
does by default. A notable example is the layer.contents
property, which is animatable by default for a hosted layer, but cannot be animated using a UIView
animation block.
The easiest way to start using the LLVM C++ API by example is to have LLVM generate the API usage for a given code sample. In this example it will emit the code required to rebuild the test.c
sample by using LLVM:
$ clang -c -emit-llvm test.c -o test.ll
$ llc -march=cpp test.ll -o test.cpp
#! /usr/bin/ruby | |
require 'pathname' | |
platform = "iphonesimulator" # or "macosx" | |
contents_xcplayground = <<XML | |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
<playground version='1.0' sdk='#{platform}'> | |
<sections> | |
<code source-file-name='section-1.swift'/> | |
</sections> |
enum FizzBuzz { | |
case fizz | |
case buzz | |
case fizzBuzz | |
case number(Int) | |
init(rawValue: Int) { | |
switch (rawValue % 3, rawValue % 5) { | |
case (0, 0): self = .fizzBuzz | |
case (0, _): self = .fizz |