-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
433803a
commit fbb6569
Showing
5 changed files
with
118 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
import UIKit | ||
|
||
public protocol HammerLocatable { | ||
func screenHitPoint(for eventGenerator: EventGenerator) throws -> CGPoint | ||
func windowHitPoint(for eventGenerator: EventGenerator) throws -> CGPoint | ||
} | ||
|
||
extension CGPoint: HammerLocatable { | ||
public func screenHitPoint(for eventGenerator: EventGenerator) throws -> CGPoint { | ||
public func windowHitPoint(for eventGenerator: EventGenerator) throws -> CGPoint { | ||
return self | ||
} | ||
} | ||
|
||
extension CGRect: HammerLocatable { | ||
public func screenHitPoint(for eventGenerator: EventGenerator) throws -> CGPoint { | ||
public func windowHitPoint(for eventGenerator: EventGenerator) throws -> CGPoint { | ||
return self.center | ||
} | ||
} | ||
|
||
extension UIView: HammerLocatable { | ||
public func screenHitPoint(for eventGenerator: EventGenerator) throws -> CGPoint { | ||
return try eventGenerator.screenHitPoint(forView: self) | ||
public func windowHitPoint(for eventGenerator: EventGenerator) throws -> CGPoint { | ||
return try eventGenerator.windowHitPoint(forView: self) | ||
} | ||
} | ||
|
||
extension UIViewController: HammerLocatable { | ||
public func screenHitPoint(for eventGenerator: EventGenerator) throws -> CGPoint { | ||
return try self.view.screenHitPoint(for: eventGenerator) | ||
public func windowHitPoint(for eventGenerator: EventGenerator) throws -> CGPoint { | ||
return try self.view.windowHitPoint(for: eventGenerator) | ||
} | ||
} | ||
|
||
extension String: HammerLocatable { | ||
public func screenHitPoint(for eventGenerator: EventGenerator) throws -> CGPoint { | ||
return try eventGenerator.viewWithIdentifier(self).screenHitPoint(for: eventGenerator) | ||
public func windowHitPoint(for eventGenerator: EventGenerator) throws -> CGPoint { | ||
return try eventGenerator.viewWithIdentifier(self).windowHitPoint(for: eventGenerator) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters