Skip to content

Commit 79363a6

Browse files
authored
Merge pull request #14 from mtj0928/add-api-doc-essentials
add api doc essentials
2 parents 154eba1 + fc154b5 commit 79363a6

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

Sources/SlideKit/Slide.swift

+42
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,57 @@
77

88
import SwiftUI
99

10+
/// A type that represents your presentation slide.
11+
/// This represents one page of your presentation.
12+
///
13+
/// You can make your slide like this.
14+
/// ```swift
15+
/// struct SampleSlide: Slide {
16+
///
17+
/// enum Substep: Int, PhasedState {
18+
/// case initial, second, third
19+
/// }
20+
///
21+
/// @Phase var phasedStateStore: PhasedStateStore<Substep>
22+
///
23+
/// var body: some View {
24+
/// HeaderSlide("Phased Slide") {
25+
/// Item("1st step", accessory: 1)
26+
///
27+
/// if phasedStateStore.after(.second) {
28+
/// Item("2nd step", accessory: 2)
29+
/// }
30+
/// if phasedStateStore.after(.third) {
31+
/// Item("3rd step", accessory: 3)
32+
/// }
33+
/// }
34+
/// }
35+
/// }
36+
/// ```
1037
public protocol Slide: View {
1138

39+
/// A type which shows sub-steps in your slide.
40+
/// The default type is ``SimplePhasedState``.
1241
associatedtype SlidePhasedState: PhasedState
42+
1343
typealias Phase = PhaseWrapper<SlidePhasedState>
1444

45+
/// A store which controls current ``SlidePhasedState``.
46+
///
47+
/// You can get current ``SlidePhasedState`` and forward / back it.
48+
/// > Note: The property must be defined with ``Phase`` like the bellow.
49+
///
50+
/// ```swift
51+
/// @Phase var phasedStateStore: PhasedStateStore<SlidePhasedState>
52+
/// ```
1553
var phasedStateStore: PhasedStateStore<SlidePhasedState> { get }
1654

55+
/// A script for the current slide. The script will be shown on presenter view (macOS only).
56+
/// The default value is an empty String.
1757
var script: String { get }
1858

59+
/// A boolean value indicating whether the slide index at the right bottom is hidden or not.
60+
/// The default value is `false`
1961
var shouldHideIndex: Bool { get }
2062
}
2163

Sources/SlideKit/SlideComponents/Templates/HeaderSlide.swift

+25-1
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,37 @@
77

88
import SwiftUI
99

10-
public struct HeaderSlide: View {
10+
/// A template slide which has a title and a content.
11+
///
12+
/// ``HeaderSlide`` is one of template slides.
13+
/// The design can be customized by using ``HeaderSlideStyle``.
14+
///
15+
/// ```swift
16+
/// var body: some View {
17+
/// HeaderSlide("SampleSlide") {
18+
/// Item("1st item")
19+
/// Item("2nd item")
20+
/// Item("3rd item")
21+
/// }
22+
/// .headerSlideStyle(CustomizedHeaderSlideStyle())
23+
/// }
24+
/// ```
25+
///
26+
/// ## Topics
27+
/// ### Customize Style
28+
/// - ``HeaderSlideStyle``
29+
public struct HeaderSlide: Slide {
1130

1231
@Environment(\.headerSlideStyle)
1332
private var style
1433

1534
private var configuration: HeaderSlideStyleConfiguration
1635

36+
/// Creates a header slide.
37+
/// - Parameters:
38+
/// - header: A text which is shown on the slide
39+
/// - fontWeight: A fontWeight of the header text.
40+
/// - content: A content of the slide.
1741
public init(_ header: String, fontWeight: Font.Weight = .semibold, @ViewBuilder content: @escaping () -> some View) {
1842
self.configuration = HeaderSlideStyleConfiguration(
1943
header: .init {

0 commit comments

Comments
 (0)