Skip to content

Commit 3ff2a0c

Browse files
committed
add script to generate documents with docc
1 parent 35be38c commit 3ff2a0c

File tree

7 files changed

+122
-0
lines changed

7 files changed

+122
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ DerivedData/
77
.swiftpm/config/registries.json
88
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
99
.netrc
10+
11+
docs

Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.PHONY: docc
2+
docc:
3+
bash scripts/docc.sh
4+
5+
.PHONY: docc-preview
6+
docc-preview:
7+
bash scripts/docc-preview.sh
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# ``TouchTracker``
2+
3+
👆Show a mark at the touched point on the View.
4+
5+
@Metadata {
6+
@DocumentationExtension(mergeBehavior: append)
7+
@Available(iOS, introduced: "13.0")
8+
}
9+
10+
<!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@-->
11+
12+
## Overview
13+
14+
``TouchTracker`` allows you to display a mark on a touched point on your app with a simple setup.
15+
Both UIKit and SwiftUI are supported.
16+
17+
![Example of TouchTracker](TouchTrackerExample.png)
18+
19+
In SwiftUI, it can be used as follows
20+
21+
```swift
22+
Text("Hello")
23+
.touchTrack()
24+
```
25+
26+
In the case of UIKit, this can be set by adding ``TouchTrackingUIView`` to the subview as follows.
27+
28+
```swift
29+
let v = TouchTrackingUIView()
30+
31+
self.view.addSubview(v)
32+
33+
v.translatesAutoresizingMaskIntoConstraints = false
34+
NSLayoutConstraint.activate([
35+
v.topAnchor.constraint(equalTo: window.topAnchor),
36+
v.bottomAnchor.constraint(equalTo: window.bottomAnchor),
37+
v.leftAnchor.constraint(equalTo: window.leftAnchor),
38+
v.rightAnchor.constraint(equalTo: window.rightAnchor),
39+
])
40+
```
41+
42+
<!--@START_MENU_TOKEN@-->Text<!--@END_MENU_TOKEN@-->
43+
44+
## Topics
45+
46+
### <!--@START_MENU_TOKEN@-->Group<!--@END_MENU_TOKEN@-->
47+
48+
- <!--@START_MENU_TOKEN@-->``Symbol``<!--@END_MENU_TOKEN@-->

Sources/TouchTracker/TouchTracker.swift

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import UIKit
55
#endif
66

77
@available(macOS, unavailable)
8+
@available(iOS 13.0, *)
89
public struct TouchTrackingView<Content: View>: View {
910
let content: Content
1011

@@ -85,6 +86,7 @@ public struct TouchTrackingView<Content: View>: View {
8586
}
8687

8788
@available(macOS, unavailable)
89+
@available(iOS 13.0, *)
8890
extension TouchTrackingView {
8991
/// radius of mark on touched point
9092
public func touchPointRadius(_ radius: CGFloat) -> Self {

scripts/docc-preview.sh

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
TARGET='TouchTracker'
2+
SCHEME='TouchTracker'
3+
4+
clean_build() {
5+
rm -rf ./.build
6+
}
7+
8+
clean_xcbuild() {
9+
destination=$1
10+
xcodebuild -scheme "$SCHEME" \
11+
-destination "generic/platform=${destination}" \
12+
clean
13+
}
14+
15+
generate_symbol_graphs() {
16+
destination=$1
17+
18+
mkdir -p .build/symbol-graphs
19+
20+
xcodebuild -scheme ${SCHEME} \
21+
-destination "generic/platform=${destination}" \
22+
OTHER_SWIFT_FLAGS="-emit-extension-block-symbols -emit-symbol-graph -emit-symbol-graph-dir ./.build/symbol-graphs"
23+
24+
mv "./.build/symbol-graphs/$SCHEME.symbols.json" "./.build/symbol-graphs/${SCHEME}_${destination}.symbols.json"
25+
}
26+
27+
clean_build
28+
clean_xcbuild ios
29+
30+
generate_symbol_graphs ios
31+
32+
$(xcrun --find docc) preview \
33+
./Sources/TouchTracker/TouchTracker.docc \
34+
--additional-symbol-graph-dir .build/symbol-graphs \
35+
--output-path "docs"

scripts/docc.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
SCHEME='TouchTracker'
4+
REPO_NAME='TouchTracker'
5+
6+
build_clean() {
7+
destination="$1"
8+
9+
xcodebuild clean \
10+
-destination "generic/platform=$destination" \
11+
-scheme "$SCHEME"
12+
}
13+
14+
generate_docc() {
15+
destination="$1"
16+
17+
mkdir -p docs
18+
19+
xcodebuild docbuild \
20+
-scheme "$SCHEME" \
21+
-destination "generic/platform=$destination" \
22+
OTHER_DOCC_FLAGS="--transform-for-static-hosting --hosting-base-path {REPO_NAME} --output-path docs" \
23+
OTHER_SWIFT_FLAGS="-emit-extension-block-symbols"
24+
# OTHER_SWIFT_FLAGS -symbol-graph-minimum-access-level private
25+
}
26+
27+
build_clean ios
28+
generate_docc ios

0 commit comments

Comments
 (0)