Skip to content

Commit 5e0bcdd

Browse files
authored
Merge pull request #35 from p-x9/feature/add-doc-comments
add more doc comments
2 parents 15ab864 + d2c7959 commit 5e0bcdd

File tree

5 files changed

+29
-1
lines changed

5 files changed

+29
-1
lines changed

Sources/TouchTracker/Cocoa/TouchTrackingUIView.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
#if canImport(UIKit)
1010
import UIKit
1111

12+
/// Anchor view to display a mark on a touched point in a UIKit View
13+
///
14+
/// You can use it by adding the touched point to a subview of the view you wish to display.
15+
///
16+
/// Since this view is simply used as an anchor, there is no problem setting isHidden to true or setting backgroundColor to clear.
17+
///
18+
/// By enabling `isShowLocation`, the coordinates displayed will be calculated using the upper left corner of this anchor view as the origin.
1219
public class TouchTrackingUIView: UIView {
1320
/// radius of mark on touched point
1421
public var radius: CGFloat
@@ -120,6 +127,8 @@ public class TouchTrackingUIView: UIView {
120127
UIWindow.hook()
121128
}
122129

130+
/// It is possible to use ``TouchPointStyle`` to set the initial settings for each property.
131+
/// - Parameter style: Style settings such as mark size and color
123132
@available(iOS 14.0, *)
124133
public convenience init(style: TouchPointStyle) {
125134
self.init(

Sources/TouchTracker/Extension/UIWindow+.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extension UIView {
2424
}
2525

2626
extension UIWindow {
27-
static public var hooked = false
27+
static var hooked = false
2828

2929
static func hook() {
3030
if Self.hooked { return }

Sources/TouchTracker/Model/DisplayMode.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@
1010
import UIKit
1111
#endif
1212

13+
/// Conditions for displaying touched points.
1314
public enum DisplayMode {
15+
/// Always display touched points
1416
case always
17+
/// Display touched points only during debug builds
1518
case debugOnly
19+
/// Display touched points only during screen recording
1620
case recordingOnly
1721
}
1822

Sources/TouchTracker/Model/TouchPointStyle.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import SwiftUI
1010

11+
/// Style of the mark displayed at the touched point
1112
public struct TouchPointStyle: Equatable {
1213
/// radius of mark on touched point
1314
public var radius: CGFloat

Sources/TouchTracker/TouchTracker.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ import SwiftUI
44
import UIKit
55
#endif
66

7+
/// A view to display a mark on a touched point in a SwiftUI View
8+
///
9+
/// It can be used in the following two ways.
10+
/// - Wrap the content with this view
11+
/// ```swift
12+
/// TouchTrackingView {
13+
/// Text("Content View")
14+
/// }
15+
/// ```
16+
/// - Use modifier of SwiftUI.View
17+
/// ```swift
18+
/// Text("Content View")
19+
/// .touchTrack()
20+
/// ```
721
@available(macOS, unavailable)
822
@available(iOS 13.0, *)
923
public struct TouchTrackingView<Content: View>: View {

0 commit comments

Comments
 (0)