I'm trying to pass a function to a closure or another function, but there are overloads which prevent compilation due to ambiguity. I'm wondering if this can actually be done?
Here's a simple example of what I'm trying to achieve -
let closure: (UILabel, String, ((CGFloat) -> (UIFont))) -> () = { (label, text, createFont) in
label.text = text
label.font = createFont(20)
}
let systemFont = UIFont.systemFont // won't compile - Ambiguous use of 'systemFont'
let boldSystemFont = UIFont.boldSystemFont // this is fine, no overloads
closure(myLabel, "Some text", systemFont)
closure(myOtherLabel, "More text", boldSystemFont)
Is there a way to specify which overload I want? No amount of searching on SO or Google has been able to answer this for me.