"NSRectEdge" is ambiguous for looking up types in this context
I have a custom view controller that loads objects from XIB, one of which is NSPopover
.
I have a method on a view controller that essentially goes through a popover, for example:
func showRelativeToRect(positioningRect: NSRect, ofView positioningView: NSView!, preferredEdge: NSRectEdge) {
self.popover.showRelativeToRect(positioningRect, ofView: positioningView, preferredEdge: preferredEdge)
}
However, this causes a compilation error which I don't quite understand:
/Users/Craig/projects/.../EditItemPopoverController.swift:23:102: 'NSRectEdge' is ambiguous for type lookup in this context
This appears to be caused by conflicting available types NSRectEdge
, as evidenced by the autocomplete:
How can I tell Swift that I would like to use a specific type? Diving in the class NSPopover.swift
seems to use the version:
typealias NSRectEdge = Int
But I don't know how to tell the Swift compiler in my opinion that this is the type I want to use. I can work around this by specifying what my method accepts Int
instead NSRectEdge
, but I would like to use the same method signature as the popover.
source to share
I tried to compile a test project with this code using
typealias NSRectEdge = Int
at the top of the file and it worked - maybe just updating it to work. This is not documented anywhere.
Indeed, I think there should be a separate command in C #, for example using
, but there is not yet.
source to share