I am using objective-git with Swift and cannot compile the GTRepository.createCommitWithTree method.
The method can optionally be called without author : GTSignature and committer : GTSignature parameters.
I'm new to Swift and overloading functions. I'd like to know how to structure this so it will compile.
My code uses all the types specified in the objective-git method:
func commitTree ( tree : GTTree ) {
let message : NSString
let author : GTSignature
let committer : GTSignature
let parents : NSArray
let updatingReferenceNamed : NSString
var error : NSError?
GTRepository.createCommitWithTree( tree, message, author, committer, parents, updatingReferenceNamed, &error )
}
In this code, compiler cannot invoke method with an argument list of these types. Compiler provides additional information: "Overloads for 'createCommitWithTree' exist with these partially matching parameter lists: (GTTree, message: String, author: GTSignature, committer: GTSignature, parents: [AnyObject]?, updatingReferenceNamed: String?), (GTTree, message: String, parents: [AnyObject]?, updatingReferenceNamed: String?)"
If I refactor to use the types suggested above, compiler won't compile with "Ambiguous reference to member 'createCommitWithTree'"
How do I write this to compile?
Thanks