Skip to content

Commit e08ea41

Browse files
committed
Document more of the public API
1 parent 5d604fb commit e08ea41

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

InAppViewDebugger/Element.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,19 @@ import CoreGraphics
2121
case important
2222
}
2323

24+
/// A human readable name for the element.
2425
@objc public let name: String?
26+
27+
/// Classification for an element that determines how it is represented
28+
/// in the view debugger.
2529
@objc public let classification: Classification
2630

31+
/// Constructs a new `Element`
32+
///
33+
/// - Parameters:
34+
/// - name: A human readable name for the element
35+
/// - classification: Classification for an element that determines how it
36+
/// is represented in the view debugger.
2737
@objc public init(name: String?, classification: Classification = .normal) {
2838
self.name = name
2939
self.classification = classification
@@ -32,11 +42,24 @@ import CoreGraphics
3242

3343
/// A UI element that can be snapshotted.
3444
@objc(IAVDElement) public protocol Element {
45+
/// Identifying information for the element, like its name and classification.
3546
var label: ElementLabel { get }
47+
48+
/// A shortened description of the element.
3649
var shortDescription: String { get }
50+
51+
/// The full length description of the element.
3752
var description: String { get }
53+
54+
/// The frame of the element in its parent's coordinate space.
3855
var frame: CGRect { get }
56+
57+
/// Whether the element is hidden from view or not.
3958
var isHidden: Bool { get }
59+
60+
/// A snapshot image of the element in its current state.
4061
var snapshotImage: CGImage? { get }
62+
63+
/// The child elements of the element.
4164
var children: [Element] { get }
4265
}

InAppViewDebugger/InAppViewDebugger.swift

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

99
import UIKit
1010

11+
/// Exposes APIs for presenting the view debugger.
1112
@objc public final class InAppViewDebugger: NSObject {
1213
/// Takes a snapshot of the application's key window and presents the debugger
1314
/// view controller from the root view controller.

InAppViewDebugger/Snapshot.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,32 @@ import Foundation
1010

1111
/// A snapshot of the UI element tree in its current state.
1212
@objc(IAVDSnapshot) public final class Snapshot: NSObject {
13+
/// Unique identifier for the snapshot.
1314
@objc public let identifier = UUID().uuidString
15+
16+
/// Identifying information for the element, like its name and classification.
1417
@objc public let label: ElementLabel
18+
19+
/// The frame of the element in its parent's coordinate space.
1520
@objc public let frame: CGRect
21+
22+
/// Whether the element is hidden from view or not.
1623
@objc public let isHidden: Bool
24+
25+
/// A snapshot image of the element in its current state.
1726
@objc public let snapshotImage: CGImage?
27+
28+
/// The child snapshots of the snapshot (one per child element).
1829
@objc public let children: [Snapshot]
30+
31+
/// The element used to create the snapshot.
1932
@objc public let element: Element
2033

34+
/// Constructs a new `Snapshot`
35+
///
36+
/// - Parameter element: The element to construct the snapshot from. The
37+
/// data stored in the snapshot will be the data provided by the element
38+
/// at the time that this constructor is called.
2139
@objc public init(element: Element) {
2240
self.label = element.label
2341
self.frame = element.frame

0 commit comments

Comments
 (0)