Skip to content

Commit

Permalink
Merge pull request #7 from hachinobu/feature_insidespotlight_touch
Browse files Browse the repository at this point in the history
Add isInsideSpotlight variable to spotlightViewControllerTapped
  • Loading branch information
xai3 committed Jan 25, 2016
2 parents 6f0c1d9 + 4fa8e4b commit 8f74789
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Classes/SpotlightViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit

public protocol SpotlightViewControllerDelegate: class {
func spotlightViewControllerTapped(viewController: SpotlightViewController)
func spotlightViewControllerTapped(viewController: SpotlightViewController, isInsideSpotlight: Bool)
}

public class SpotlightViewController: UIViewController {
Expand Down Expand Up @@ -88,7 +88,9 @@ public class SpotlightViewController: UIViewController {

extension SpotlightViewController {
func viewTapped(gesture: UITapGestureRecognizer) {
delegate?.spotlightViewControllerTapped(self)
let touchPoint = gesture.locationInView(spotlightView)
let isInside = spotlight.frame.contains(touchPoint)
delegate?.spotlightViewControllerTapped(self, isInsideSpotlight: isInside)
}
}

Expand Down
2 changes: 1 addition & 1 deletion GeccoExample/AnnotationViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class AnnotationViewController: SpotlightViewController {
}

extension AnnotationViewController: SpotlightViewControllerDelegate {
func spotlightViewControllerTapped(viewController: SpotlightViewController) {
func spotlightViewControllerTapped(viewController: SpotlightViewController, isInsideSpotlight: Bool) {
next(true)
}
}

0 comments on commit 8f74789

Please sign in to comment.