File tree Expand file tree Collapse file tree 5 files changed +29
-1
lines changed
Expand file tree Collapse file tree 5 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 99#if canImport(UIKit)
1010import 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.
1219public 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 (
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ extension UIView {
2424}
2525
2626extension UIWindow {
27- static public var hooked = false
27+ static var hooked = false
2828
2929 static func hook( ) {
3030 if Self . hooked { return }
Original file line number Diff line number Diff line change 1010import UIKit
1111#endif
1212
13+ /// Conditions for displaying touched points.
1314public 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
Original file line number Diff line number Diff line change 88
99import SwiftUI
1010
11+ /// Style of the mark displayed at the touched point
1112public struct TouchPointStyle : Equatable {
1213 /// radius of mark on touched point
1314 public var radius : CGFloat
Original file line number Diff line number Diff line change @@ -4,6 +4,20 @@ import SwiftUI
44import 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 , * )
923public struct TouchTrackingView < Content: View > : View {
You can’t perform that action at this time.
0 commit comments