View Process.swift
// 1
let process = Process()
process.launch()
process.waitUntilExit()
// 2.
let process = Process()
let queue = DispatchQueue()
queue.async {
View optional.swift
guard let foo = foo else {
assertionFailure("This shouldn't happen")
return
}
View LocalAuthentication.swift
// MARK: - guard without Optional Pattern
extension LocalAuthentication {
convenience init?(authenticationLevel: AuthenticationLevel?){
guard let authenticationLevel = authenticationLevel else {
return nil
}
switch authenticationLevel {
View Avatar.swift
struct Imager
{
unowned let session: Session
unowned let avatar: Avatar
func image(imageView: UIImageView) {
let download = self.session.download(self.avatar.image) { [weak imageView = imageView] (data, response, _) in
guard let _imageView = imageView else {
View ViewController.swift
class ViewController : UIViewController
{
var foo = "foo"
func hello()
{
let closure = { [foo = self.foo] in
print("Hello \(foo)!")
}
}
View AppDelegate.swift
class FooViewController: UIViewController
{
}
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let fooViewController = FooViewController()
let view = self.window!.snapshotViewAfterScreenUpdates(false)
let viewController = UIViewController()
View AppDelegate.swift
//
// AppDelegate.swift
// Keychain
//
// Created by Markos Charatzas on 07/09/2014.
// Copyright (c) 2014 qnoid.com. All rights reserved.
//
import Cocoa
View SuperclassCallsOverridableMethod.playground
import Cocoa
class Plane
{
init()
{
readyToTakeOff();
}
func readyToTakeOff(){
View Foo.m
@interface Foo()
@property(nonatomic, strong) dispatch_group_t lock;
@end
@implementation Foo
-(id)init
{
self = [super init];
View main.m
#import <Foundation/Foundation.h>
int main(int argc, char *argv[])
{
NSArray *array = @[ @"a", @"b", @"c" ];
for (NSUInteger i = 0; i < array.count; i++)
{
NSLog(@"%@", array[i]);
}