Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.

Commit

Permalink
Add simulator warning
Browse files Browse the repository at this point in the history
  • Loading branch information
morizotter committed Jun 2, 2015
1 parent bd7695f commit 69ce7b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Example/Example/ConfigViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ final class ConfigViewController: UITableViewController {
if isSimulator() {
let controller = UIAlertController(
title: "Warning",
message: "This property doesn't work on simulator because it is not possible to read touch radius on it. Please test it on device.",
message: "This property doesn't work on the simulator because it is not possible to read touch radius on it. Please test it on device.",
preferredStyle: .Alert
)
controller.addAction(UIAlertAction(title: "OK", style: .Cancel, handler: nil))
Expand Down
8 changes: 8 additions & 0 deletions Pod/Classes/Visualizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ final public class Visualizer {
NSNotificationCenter.defaultCenter().addObserver(self, selector: "orientationDidChangeNotification:", name: UIDeviceOrientationDidChangeNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "applicationDidBecomeActiveNotification:", name: UIApplicationDidBecomeActiveNotification, object: nil)
UIDevice.currentDevice().beginGeneratingDeviceOrientationNotifications()

warnIfSimulator()
}

deinit {
Expand Down Expand Up @@ -143,6 +145,12 @@ extension Visualizer {
}

extension Visualizer {
private func warnIfSimulator() {
#if (arch(i386) || arch(x86_64)) && os(iOS)
println("[TouchVisualizer] Warning: TouchRadius doesn't work on the simulator because it is not possible to read touch radius on it.")
#endif
}

public func log(touch: UITouch) {
if !config.showsLog {
return
Expand Down

0 comments on commit 69ce7b6

Please sign in to comment.