This file contains hidden or 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
// | |
// MKMapViewExtension.swift | |
// AutocompleteTextfieldSwift | |
// | |
// Created by Mylene Bayan on 2/22/15. | |
// Copyright (c) 2015 MaiLin. All rights reserved. | |
// | |
import Foundation | |
import MapKit |
This file contains hidden or 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
/// An object that has some tear-down logic | |
public protocol Disposable { | |
func dispose() | |
} | |
/// An event provides a mechanism for raising notifications, together with some | |
/// associated data. Multiple function handlers can be added, with each being invoked, | |
/// with the event data, when the event is raised. | |
public class Event<T> { |
This file contains hidden or 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
// Updated to Swift 1.2 and CocoaLumberjack 2.0.0-rc by Stan Serebryakov on 2015-02-16 | |
import Foundation | |
extension DDLog { | |
private struct State { | |
static var logLevel: DDLogLevel = .Error | |
static var logAsync: Bool = true | |
} |
This file contains hidden or 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
let array = ["P","Q","R","S","T","P","R","A","T","B","C","P","P","P","P","P","C","P","P","J"] | |
extension Array { | |
func unique<T: Equatable>() -> [T] { | |
return self.reduce([T](), combine: { (array, value) -> [T] in | |
var result = array | |
let valAsT = value as T | |
if (!contains(array, valAsT)) { | |
result.append(valAsT) | |
} |
This file contains hidden or 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
require 'xcodeproj' | |
project_path = "your_project_path"; | |
# Create project object | |
project = Xcodeproj::Project.new(project_path); | |
lib_path = "your_lib_path"; | |
# Add the lib file as a reference | |
libRef = project['Frameworks'].new_file(lib_path); |
This file contains hidden or 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
- (void)reconfigureVisibleCells | |
{ | |
NSInteger sectionCount = [self numberOfSectionsInTableView:self.tableView]; | |
for (NSInteger section = 0; section < sectionCount; ++section) { | |
NSInteger rowCount = [self tableView:self.tableView numberOfRowsInSection:section]; | |
for (NSInteger row = 0; row < rowCount; ++row) { | |
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section]; | |
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath]; |
This file contains hidden or 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 Foundation | |
var token: dispatch_once_t = 0 | |
func test() { | |
dispatch_once(&token) { | |
println("This is printed only on the first call to test()") | |
} | |
println("This is printed for each call to test()") | |
} |
This file contains hidden or 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
// | |
// KVOTests.swift | |
// SwiftStuff | |
// | |
// Created by Venkat Peri on 8/11/14. | |
// Copyright (c) 2014 vperi. All rights reserved. | |
// | |
import Cocoa | |
import XCTest |
This file contains hidden or 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 CoreLocation | |
extension CLLocationCoordinate2D: Equatable {} | |
public func ==(lhs: CLLocationCoordinate2D, rhs: CLLocationCoordinate2D) -> Bool { | |
return lhs.latitude == rhs.latitude && lhs.longitude == rhs.longitude | |
} |
This file contains hidden or 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
typealias ServiceResponse = (NSDictionary?, NSError?) -> Void | |
class DataProvider: NSObject { | |
var client:AFHTTPRequestOperationManager? | |
let LOGIN_URL = "/api/v1/login" | |
class var sharedInstance:DataProvider { | |
struct Singleton { | |
static let instance = DataProvider() |