This is the error (Cannot call value of non-function type 'CGPoint') I receive at the call to UIView:point() in the following code:
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView?
{
if point(inside: point, with: event)
{
gViewCtr.DismissAll()
gViewCtr.fCF_UndoBtn.isEnabled = (gCollector.fWaypoint!.count > 0)
gViewCtr.fCampfireControls.isHidden = false
return self
}
else { return nil }
}
The call to point() to determine whether the receiver contains the argument CGPoint is straight out of the manual.
Does it have something to do with the argument having the same label as the function?
Renaming the argument with a temporary variable does not help, however.
Any help greatly appreciated.
Steve.
Yes, the problem is that "point" is interpreted as the parameter, masking the name of the instance method "point(inside:,with:)". If you want, you can solve it without renaming by making the method receiver explicit:
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
if self.point(inside: point, with: event)
or you can rename the parameter:
override func hitTest(_ testPoint: CGPoint, with event: UIEvent?) -> UIView? {
if point(inside: testPoint, with: event)
Both of those compile without error for me.