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
/// The current element attributes state | |
internal struct TagAttributes | |
{ | |
var tagName: String! | |
var URL: NSURL? | |
var imageURL: NSURL? | |
var isUnderlined: Bool = false | |
var isStriken: Bool = false | |
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
extension Dictionary where Key: String, Value: NSFileWrapper | |
{ | |
mutating func renameBundleResource(oldName: String, newName: String) | |
{ | |
// remove extension | |
let prefix = (oldName as NSString).stringByDeletingPathExtension | |
// find all files belonging to this resource | |
let fileNames = keys.sort().filter { (key) -> Bool in | |
return key.hasPrefix(prefix) |
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
public extension CollectionType where Generator.Element == NSIndexPath | |
{ | |
func indexPathsWithSectionModified(by modifier: Int) -> [NSIndexPath] | |
{ | |
var modifiedIndexPaths = [NSIndexPath]() | |
for indexPath in self | |
{ | |
let modifiedIndexPath = NSIndexPath(forItem: indexPath.item, inSection: indexPath.section + modifier) | |
modifiedIndexPaths.append(modifiedIndexPath) |
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
Pod::Spec.new do |spec| | |
spec.name = 'BarCodeKit' | |
spec.version = '1.3.1' | |
spec.license = 'BSD' | |
spec.source = { :git => 'https://github.com/Cocoanetics/BarCodeKit.git', :tag => spec.version.to_s } | |
spec.ios.source_files = 'Core/Source/iOS/*.{h,m}', 'Core/Source/*.{h,m}', 'Core/*.h' | |
spec.osx.source_files = 'Core/Source/Mac/*.{h,m}', 'Core/Source/*.{h,m}', 'Core/*.h' | |
spec.requires_arc = true | |
spec.homepage = 'http://www.cocoanetics.com/parts/barcodekit/' | |
spec.summary = 'A framework to generate bar codes on iOS or Mac.' |
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
extension NSPersistentStoreCoordinator | |
{ | |
func batchDelete(fetchRequest: NSFetchRequest) throws | |
{ | |
// create a worker | |
let context = NSManagedObjectContext(concurrencyType: .PrivateQueueConcurrencyType) | |
context.persistentStoreCoordinator = self | |
var retError: NSError! | |
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
enum Result | |
{ | |
case Success() | |
case Error(error: NSError) | |
case Properties(nodes: [WebDAVNode]) | |
} | |
typealias WebDAVRequestCompletion = (Result)->() | |
func listDirectory(path: String, completion: WebDAVRequestCompletion?) |
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
// Swift version of https://developer.apple.com/library/mac/technotes/tn2084/_index.html | |
@IBAction func testButtonPushed(sender: AnyObject) { | |
let URL = NSBundle.mainBundle().URLForResource("SendFinderMessage", withExtension: "scpt")! | |
var errors: NSDictionary? | |
let script = NSAppleScript(contentsOfURL: URL, error: &errors)! | |
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
// Swift version of https://developer.apple.com/library/mac/technotes/tn2084/_index.html | |
@IBAction func testButtonPushed(sender: AnyObject) { | |
let URL = NSBundle.mainBundle().URLForResource("SendFinderMessage", withExtension: "scpt")! | |
var errors: NSDictionary? | |
let script = NSAppleScript(contentsOfURL: URL, error: &errors)! | |
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
func enumeratePointsOnLine(startPoint: CGPoint, endPoint: CGPoint, maxDistance: CGFloat, block: (point: CGPoint)->()) | |
{ | |
// for single point we don't iterate anything | |
guard !CGPointEqualToPoint(startPoint, endPoint) else | |
{ | |
block(point: startPoint) | |
return | |
} | |
let deltaX = endPoint.x - startPoint.x |