Skip to content

Instantly share code, notes, and snippets.

@lazabogdan
Created September 24, 2015 13:31
Show Gist options
  • Save lazabogdan/21fdd349ff67ed07d6c0 to your computer and use it in GitHub Desktop.
Save lazabogdan/21fdd349ff67ed07d6c0 to your computer and use it in GitHub Desktop.

Revisions

  1. lazabogdan created this gist Sep 24, 2015.
    30 changes: 30 additions & 0 deletions Utilities.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    //
    // Utilities.swift
    // swift-couchbaselite
    //
    // Created by Jens Alfke on 9/17/14.
    // Copyright (c) 2014 Couchbase, Inc. All rights reserved.
    //

    import Foundation


    extension CBLView {
    // Just reorders the parameters to take advantage of Swift's trailing-block syntax.
    func setMapBlock(version: String, mapBlock: CBLMapBlock) -> Bool {
    return setMapBlock(mapBlock, version: version)
    }
    }

    extension CBLDocument {
    // Just reorders the parameters to take advantage of Swift's trailing-block syntax.
    func update(error: NSErrorPointer, block: ((CBLUnsavedRevision!) -> Bool)) -> CBLSavedRevision? {
    return update(block, error: error)
    }
    }

    extension NSDate {
    class func withJSONObject(jsonObj: AnyObject) -> NSDate? {
    return CBLJSON.dateWithJSONObject(jsonObj)
    }
    }