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

Added SwiftPM support #110

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// swift-tools-version:5.2
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "TouchVisualizer",
platforms: [.iOS(.v9)],
products: [
.library(
name: "TouchVisualizer",
targets: ["TouchVisualizer"]),
],
targets: [
.target(
name: "TouchVisualizer",
path: "TouchVisualizer",
exclude: ["Info.plist"]
)
]
)
6 changes: 4 additions & 2 deletions TouchVisualizer/UIWindow+Swizzle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import UIKit

fileprivate var isSwizzled = false

@available(iOS 8.0, *)
@available(iOSApplicationExtension, unavailable)
extension UIWindow {


@available(iOS 8.0, *)
public func swizzle() {
guard isSwizzled == false else {
return
Expand All @@ -30,6 +31,7 @@ extension UIWindow {
}

// MARK: - Swizzle
@available(iOSApplicationExtension, unavailable)
extension UIWindow {
@objc public func swizzledSendEvent(_ event: UIEvent) {
Visualizer.sharedInstance.handleEvent(event)
Expand Down
5 changes: 4 additions & 1 deletion TouchVisualizer/Visualizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

import UIKit

final public class Visualizer:NSObject {
@available(iOSApplicationExtension, unavailable)
final public class Visualizer: NSObject {

// MARK: - Public Variables
static public let sharedInstance = Visualizer()
Expand Down Expand Up @@ -57,6 +58,7 @@ final public class Visualizer:NSObject {
}
}

@available(iOSApplicationExtension, unavailable)
extension Visualizer {
public class func isEnabled() -> Bool {
return sharedInstance.enabled
Expand Down Expand Up @@ -182,6 +184,7 @@ extension Visualizer {
}
}

@available(iOSApplicationExtension, unavailable)
extension Visualizer {
public func warnIfSimulator() {
#if targetEnvironment(simulator)
Expand Down