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
swiftgen strings ${SRCROOT}/<APP>/Base.lproj/Localizable.strings --output ${SRCROOT}/<APP>/LocalizableStrings.swift |
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
#!/usr/bin/env bash | |
set -eu | |
if git diff-index -p -M --cached HEAD -- '*.xib' '*.storyboard' | grep '^+' | egrep 'misplaced="YES"' >/dev/null 2>&1 | |
then | |
echo "COMMIT REJECTED because it contains misplaced views; please correct them before committing." | |
exit 1 | |
fi | |
if git diff-index -p -M --cached HEAD -- '*.swift' | grep '^+' | egrep 'TEST' >/dev/null 2>&1 |
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
#!/usr/bin/env bash | |
# Usage: scripts/bootstrap | |
set -eu | |
ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
SCRIPT_DIR=$(dirname "$0") | |
cd "$SCRIPT_DIR/.." |
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
// | |
// SpinlockTestTests.swift | |
// SpinlockTestTests | |
// | |
// Created by Peter Steinberger on 04/10/2016. | |
// Copyright © 2016 PSPDFKit GmbH. All rights reserved. | |
// | |
import XCTest |
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
Test Suite 'All tests' started at 2016-11-23 13:16:03.092 | |
Test Suite 'Quick.framework' started at 2016-11-23 13:16:03.093 | |
Test Suite 'Quick.framework' passed at 2016-11-23 13:16:03.093. | |
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.001) seconds | |
Test Suite 'AblySpec.xctest' started at 2016-11-23 13:16:03.094 | |
Test Suite 'RealtimeClientConnection' started at 2016-11-23 13:16:03.095 | |
Test Case '-[AblySpec.RealtimeClientConnection Connection__connection_failures_once_CONNECTED__System_s_response_to_a_resume_request__should_resume_the_connection_after_an_auth_renewal_and_detach_all_channels_if_the_connectionId_changes]' started. | |
2016-11-23 13:16:04.097 xctest[32837:4092858] DEBUG: (ARTRest.m:57) RS:0x7f955c623000 0x7f955c617b50 alloc HTTP | |
2016-11-23 13:16:04.098 xctest[32837:4092858] DEBUG: (ARTAuth.m:78) RS:0x7f955c623000 validating ARTClientOptions: key=_tmp_U7qorQ.Jl-lRg:3XINc2IggVonxFd9 token=_tmp_U7qorQ.DpFF_XDx2ZDmtlrAdFrPgOvnn-9k3W10UiJam2XZytbRKSVDhdCs4YT5EnNkEZz0pykArPnjAfXf0EYxG51dv8SxY7fg |
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 UIKit | |
class ModalViewController: UIViewController, NSURLSessionDelegate { | |
var session: NSURLSession! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
session = NSURLSession(configuration: NSURLSessionConfiguration.ephemeralSessionConfiguration(), delegate: self, delegateQueue: nil) |
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
// put this in your AppDelegate | |
- (void)changeRootViewController:(UIViewController*)viewController { | |
if (!self.window.rootViewController) { | |
self.window.rootViewController = viewController; | |
return; | |
} | |
UIView *snapShot = [self.window snapshotViewAfterScreenUpdates:YES]; | |
[viewController.view addSubview:snapShot]; | |
self.window.rootViewController = viewController; |
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
@interface MyStringProxy : NSProxy | |
@property (nonatomic) NSString *target; | |
@end | |
@implementation MyStringProxy | |
- (BOOL)respondsToSelector:(SEL)aSelector { |
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
class ViewController: UIViewController { | |
var image: UIImage! | |
var imageView: UIImageView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let avatarData = NSData(contentsOfURL: NSURL(string: "https://www.gravatar.com/avatar/7d7c8bd1f797a0e9b474e52c3968cbde?s=48&d=identicon&r=PG")!) | |
let landscapeData = NSData(contentsOfURL: NSURL(string: "https://upload.wikimedia.org/wikipedia/commons/e/e4/Stourhead_garden.jpg")!) |