Skip to content

Commit

Permalink
Merge pull request #35 from p-x9/feature/add-doc-comments
Browse files Browse the repository at this point in the history
add more doc comments
  • Loading branch information
p-x9 authored Oct 27, 2023
2 parents 15ab864 + d2c7959 commit 5e0bcdd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Sources/TouchTracker/Cocoa/TouchTrackingUIView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
#if canImport(UIKit)
import UIKit

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

/// It is possible to use ``TouchPointStyle`` to set the initial settings for each property.
/// - Parameter style: Style settings such as mark size and color
@available(iOS 14.0, *)
public convenience init(style: TouchPointStyle) {
self.init(
Expand Down
2 changes: 1 addition & 1 deletion Sources/TouchTracker/Extension/UIWindow+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extension UIView {
}

extension UIWindow {
static public var hooked = false
static var hooked = false

static func hook() {
if Self.hooked { return }
Expand Down
4 changes: 4 additions & 0 deletions Sources/TouchTracker/Model/DisplayMode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
import UIKit
#endif

/// Conditions for displaying touched points.
public enum DisplayMode {
/// Always display touched points
case always
/// Display touched points only during debug builds
case debugOnly
/// Display touched points only during screen recording
case recordingOnly
}

Expand Down
1 change: 1 addition & 0 deletions Sources/TouchTracker/Model/TouchPointStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import SwiftUI

/// Style of the mark displayed at the touched point
public struct TouchPointStyle: Equatable {
/// radius of mark on touched point
public var radius: CGFloat
Expand Down
14 changes: 14 additions & 0 deletions Sources/TouchTracker/TouchTracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ import SwiftUI
import UIKit
#endif

/// A view to display a mark on a touched point in a SwiftUI View
///
/// It can be used in the following two ways.
/// - Wrap the content with this view
/// ```swift
/// TouchTrackingView {
/// Text("Content View")
/// }
/// ```
/// - Use modifier of SwiftUI.View
/// ```swift
/// Text("Content View")
/// .touchTrack()
/// ```
@available(macOS, unavailable)
@available(iOS 13.0, *)
public struct TouchTrackingView<Content: View>: View {
Expand Down

0 comments on commit 5e0bcdd

Please sign in to comment.