"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:

enter image description here

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.

+3


source to share


2 answers


This seems to be resolved in the latest beta. (Or maybe beta 6. All I know is that it works correctly in beta 7.)



0


source


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.

+1


source







All Articles