Skip to content

Commit

Permalink
remove nsdata conveniences
Browse files Browse the repository at this point in the history
  • Loading branch information
loganwright authored Apr 18, 2017
1 parent c42a3f4 commit 6fa0743
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions Sources/GenomeFoundation/Foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,3 @@ extension Data: NodeConvertible {
self = data
}
}

// MARK: NSData

extension NSData: NodeRepresentable {
public func makeNode(context: Context = EmptyNode) throws -> Node {
var bytes = [UInt8](repeating: 0, count: length)
getBytes(&bytes, length: bytes.count)
let data = Data(bytes: bytes)
let js = try JSONSerialization.jsonObject(with: data, options: .allowFragments)
return Node(any: js)
}
}


#if Xcode
/*
Linux won't compile this.
*/
extension NSData: NodeConvertible {}
extension NodeConvertible where Self: NSData {
public init(node: Node, in context: Context) throws {
let any = node.any
let data = try JSONSerialization.data(withJSONObject: any, options: .init(rawValue: 0))
self.init(data: data)
}
}
#endif

0 comments on commit 6fa0743

Please sign in to comment.