#Create bitbucket branch
##Create local branch
$ git checkout -b sync
Switched to a new branch 'sync'
$ git branch
master
* sync
// | |
// TransitionController.h | |
// | |
// Created by XJones on 11/25/11. | |
// | |
#import <UIKit/UIKit.h> | |
@interface TransitionController : UIViewController |
#Create bitbucket branch
##Create local branch
$ git checkout -b sync
Switched to a new branch 'sync'
$ git branch
master
* sync
//Flag | |
_isCancelled = @(NO); | |
//Create a queue | |
dispatch_queue_t queue = dispatch_queue_create("queue", NULL); | |
//Insert 3.000 blocks executed with a delay of 1 sec | |
for (int i=0; i<3000; i++) { | |
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1* NSEC_PER_SEC)), queue, ^(void){ | |
if(![_isCancelled boolValue]) |
#pragma mark - XCTest Support | |
static BOOL isRunningTests(void) __attribute__((const)); | |
/** | |
We need a mechanism to detect if we have been invoked / are running from a unit test. | |
If we are, we'll want to exit early instead of doing all kinds of view controller setup. | |
This function determines based on the environment, if we're running in a unit test process, | |
such as XCTest. |
June 1, 2014 – September 15, 2014
Percentage of total visits for sessions among the top 100 pages on ASCIIwwdc.
extension NSURL { | |
func getKeyVals() -> Dictionary<String, String>? { | |
var results = [String:String]() | |
var keyValues = self.query?.componentsSeparatedByString("&") | |
if keyValues?.count > 0 { | |
for pair in keyValues! { | |
let kv = pair.componentsSeparatedByString("=") | |
if kv.count > 1 { | |
results.updateValue(kv[1], forKey: kv[0]) | |
} |
<?xml version="1.0" encoding="UTF-8"?> | |
<Bucket | |
type = "2" | |
version = "2.0"> | |
<Breakpoints> | |
<!-- All Exceptions --> | |
<BreakpointProxy | |
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint"> | |
<BreakpointContent |
Modern Cocoa development involves a lot of asynchronous programming using blocks and NSOperations. A lot of APIs are exposing blocks and they are more natural to write a lot of logic, so we'll only focus on block-based APIs.
Block-based APIs are hard to use when number of operations grows and dependencies between them become more complicated. In this paper I introduce asynchronous semantics and Promise type to Swift language (borrowing ideas from design of throw-try-catch and optionals). Functions can opt-in to become async, programmer can compose complex logic involving asynchronous operations while compiler produces necessary closures to implement that logic. This proposal does not propose new runtime model, nor "actors" or "coroutines".
Following the tradition from last year, here's my complete list of all interesting features and updates I could find in Apple's OSes, SDKs and developer tools that were announced at this year's WWDC. This is based on the keynotes, the "What's New In ..." presentations and some others, Apple's release notes, and blog posts and tweets that I came across in the last few weeks.
If for some reason you haven't watched the talks yet, I really recommend watching at least the "State of the Union" and the "What's New In" intros for the platforms you're interested in. The unofficial WWDC Mac app is great way to download the videos and keep track of what you've already watched.
If you're interested, here are my WWDC 2015 notes (might be useful if you're planning to drop support for iOS 8 now and start using some iOS 9 APIs).
let player = AVPlayer() | |
func playFileAtURL(url: NSURL) { | |
let asset = AVAsset.assetWithURL(url) as AVAsset | |
let duration = asset.duration | |
let durationInSeconds = CMTimeGetSeconds(duration) | |
let item = AVPlayerItem(asset: asset) | |
let params = AVMutableAudioMixInputParameters(track: asset.tracks.first! as AVAssetTrack) |