Nate Mann
Nate Mann

Reputation: 673

passing two generic types as function parameters

Given as sample function:

func sample<Z: Equatable, X: IntegerType>(from: Z.Type, to: X.Type) {
    print("HELLO")
}

sample(String, to: Int)

I get the following error Missing argument for parameter 'to' in call

Am I missing something?

Upvotes: 0

Views: 972

Answers (1)

Nate Mann
Nate Mann

Reputation: 673

Looks like this will work

sample(String.self, to: Int.self)

Upvotes: 2

Related Questions