 /// Default implementation for record methods as protocol extension
 public func recordProtocolExtensionCode(e: GIR.Record, indentation: String = "    ") -> String {
     let mcode = methodCode(indentation)(e)
-    let code = "public extension \(e.node)Type {\n" +
+    let code = "public extension \(e.node)Protocol {\n" +
         e.methods.lazy.map(mcode).joinWithSeparator("\n") +
     "}\n\n"
     return code

/// Swift protocol representation of a record/class as a wrapper of a pointer
public func recordProtocolCode(e: GIR.Record, parent: String, indentation: String = "    ") -> String {
    let p = (parent.isEmpty ? "" : ": \(parent)")
    let code = "public protocol \(e.node)Type\(p) {\n" + indentation +
        "var ptr: UnsafeMutablePointer<\(e.ctype)> { get }\n" +
    "}\n\n"
    return code


/// Swift struct representation of a record/class as a wrapper of a pointer
public func recordStructCode(e: GIR.Record, indentation: String = "    ") -> String {
    let code = "public struct \(e.node)Ref: \(e.node)Protocol {\n" + indentation +
        "public let ptr: UnsafeMutablePointer<\(e.ctype)>\n" +
    "}\n\n" +
    "public extension \(e.node)Ref {\n" + indentation +
        "public init<T>(cPointer: UnsafeMutablePointer<T>) {\n" + indentation + indentation +
            "ptr = UnsafeMutablePointer<\(e.ctype)>(cPointer)\n" + indentation +
        "}\n\n" + indentation +
        "public init<T>(constPointer: UnsafePointer<T>) {\n" + indentation + indentation +
            "ptr = UnsafeMutablePointer<\(e.ctype)>(constPointer)\n" + indentation +
        "}\n\n" + indentation +
        "public init(opaquePointer: COpaquePointer) {\n" + indentation + indentation +
            "ptr = UnsafeMutablePointer<\(e.ctype)>(opaquePointer)\n" + indentation +
        "}\n\n" +
    "}\n\n"

