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
// Playground - noun: a place where people can play | |
import Cocoa | |
/* Node class implementation */ | |
class Node | |
{ | |
var data:String? | |
var link:Node? |
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 Cocoa | |
func quicksort(array:Int[])->Int[] { | |
var less = Int[](), equal = Int[](), greater = Int[]() | |
if array.count > 1{ | |
let pivot = array[0] | |
for x in array{ |
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 Cocoa | |
func quicksort<T: Comparable>(array:T[])->T[] { | |
var less = T[](), equal = T[](), greater = T[]() | |
if array.count > 1{ | |
let pivot = array[0] | |
for x in array{ |
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 ViewController: UIViewController { | |
@IBOutlet var searchBar:UISearchBar | |
@IBOutlet var tableView:UITableView | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} |
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 Manager { | |
class var sharedManager : Manager { | |
struct Singleton { | |
static let instance : Manager = Manager() // let is Thread-safe | |
} | |
return Singleton.instance | |
} | |
} |
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
extension Array { | |
func contains(object:AnyObject) -> Bool { | |
return self.bridgeToObjectiveC().containsObject(object) | |
} | |
func indexOf(object:AnyObject) -> Int { | |
return self.bridgeToObjectiveC().indexOfObject(object) | |
} | |
} |
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
//This code works correctly in the Application target, while in the Test target I get this warning: | |
//Cast from 'XCUIElement!' to unrelated type 'String' always fails. | |
//JSON is of type AnyObject? | |
let fieldErrors = JSON!["errors"] as? [String:String] | |
//I've already tried to convert this code in a more "swift 2" format using guard and removing the "optional"...nothing changes. |
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
//Request the access to the Calendar | |
[eventStore requestAccessToEntityType:EKEntityTypeEvent | |
completion:^(BOOL granted,NSError* error){ | |
//Access not granted------------- | |
if(!granted){ | |
} | |
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
+ (NSDate *)dateWithYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day { | |
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; | |
NSDateComponents *components = [[NSDateComponents alloc] init]; | |
[components setYear:year]; | |
[components setMonth:month]; | |
[components setDay:day]; | |
return [calendar dateFromComponents:components]; |
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
// From your project -> Edit scheme | |
// Tab "Run" | |
// Section "Argument passed at Lauch" | |
// Add this argument | |
-com.apple.CoreData.SQLDebug 1 |
OlderNewer