Skip to content

Commit be4c470

Browse files
committed
Sort documentation into categories and write a few overviews
1 parent b8496c0 commit be4c470

29 files changed

+446
-85
lines changed

Sources/SwiftCrossUI/Backend/AppBackend.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Foundation
22

3-
/// A backend that can be used to run an app (e.g. Gtk or Qt).
3+
/// A backend that can be used to run an app. Usually built on top of an
4+
/// existing UI framework.
45
///
56
/// Default placeholder implementations are available for all non-essential
67
/// app lifecycle methods. These implementations will fatally crash when called

Sources/SwiftCrossUI/Backend/InheritedOrientation.swift

Lines changed: 0 additions & 7 deletions
This file was deleted.

Sources/SwiftCrossUI/HotReloadingMacros.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public macro HotReloadable() =
1313
public macro hotReloadable<T: View>(@ViewBuilder _ expr: () -> T) -> HotReloadableView =
1414
#externalMacro(module: "HotReloadingMacrosPlugin", type: "HotReloadableExprMacro")
1515

16+
@_documentation(visibility: internal)
1617
public struct ExprLocation: Hashable {
1718
var line: Int
1819
var column: Int

Sources/SwiftCrossUI/Scenes/Modifiers/CommandsModifier.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
extension Scene {
2-
public func commands(@CommandsBuilder _ commands: () -> Commands) -> CommandsModifier<Self> {
2+
public func commands(@CommandsBuilder _ commands: () -> Commands) -> some Scene {
33
CommandsModifier(content: self, newCommands: commands())
44
}
55
}
66

7-
public struct CommandsModifier<Content: Scene>: Scene {
8-
public typealias Node = CommandsModifierNode<Content>
7+
struct CommandsModifier<Content: Scene>: Scene {
8+
typealias Node = CommandsModifierNode<Content>
99

10-
public var content: Content
11-
public var commands: Commands
10+
var content: Content
11+
var commands: Commands
1212

13-
public init(content: Content, newCommands: Commands) {
13+
init(content: Content, newCommands: Commands) {
1414
self.content = content
1515
self.commands = content.commands.overlayed(with: newCommands)
1616
}
1717
}
1818

19-
public final class CommandsModifierNode<Content: Scene>: SceneGraphNode {
20-
public typealias NodeScene = CommandsModifier<Content>
19+
final class CommandsModifierNode<Content: Scene>: SceneGraphNode {
20+
typealias NodeScene = CommandsModifier<Content>
2121

2222
var contentNode: Content.Node
2323

24-
public init<Backend: AppBackend>(
24+
init<Backend: AppBackend>(
2525
from scene: NodeScene,
2626
backend: Backend,
2727
environment: EnvironmentValues
@@ -33,7 +33,7 @@ public final class CommandsModifierNode<Content: Scene>: SceneGraphNode {
3333
)
3434
}
3535

36-
public func update<Backend: AppBackend>(
36+
func update<Backend: AppBackend>(
3737
_ newScene: NodeScene?,
3838
backend: Backend,
3939
environment: EnvironmentValues

Sources/SwiftCrossUI/SwiftCrossUI.docc/AppKitBackend.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AppKitBackend
22

3-
SwiftCrossUI's native macOS backend built on AppKit.
3+
SwiftCrossUI's native macOS backend built on top of AppKit.
44

55
## Overview
66

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Built-in backends
2+
3+
## Overview
4+
5+
SwiftCrossUI has a variety of backends tailored to different operating systems.
6+
7+
The beauty of SwiftCrossUI is that you can write your app once and have it look native everywhere. For this reason I recommend using `DefaultBackend` unless you've got particular constraints.
8+
9+
## Topics
10+
11+
- <doc:DefaultBackend>
12+
- <doc:AppKitBackend>
13+
- <doc:UIKitBackend>
14+
- <doc:WinUIBackend>
15+
- <doc:GtkBackend>
16+
- <doc:Gtk3Backend>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Controls
2+
3+
## Overview
4+
5+
Employ controls to receive user input.
6+
7+
## Topics
8+
9+
- ``Button``
10+
- ``TextField``
11+
- ``Slider``
12+
- ``Toggle``
13+
- ``Picker``
14+
- ``Menu``
15+
- ``List``
16+
17+
### Related
18+
19+
- ``DoubleConvertible``
20+
- ``MenuItem``
21+
- ``MenuItemsBuilder``
22+
- ``ToggleStyle``
23+
- ``TextContentType``
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Custom backends
2+
3+
## Overview
4+
5+
With being open and extensible as a core goal, SwiftCrossUI allows custom
6+
backends to be implemented in third-party packages.
7+
8+
'Simply' implement the ``AppBackend`` protocol and you're good to go!
9+
10+
## Topics
11+
12+
- ``AppBackend``
13+
- ``CellPosition``
14+
- ``MenuImplementationStyle``
15+
- ``DialogResult``
16+
- ``ResolvedMenu``
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Deprecated
2+
3+
## Topics
4+
5+
- ``ViewContent``
6+
- ``Observable``
7+
- ``Observed``
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Environment
2+
3+
## Topics
4+
5+
- ``Environment``
6+
- ``EnvironmentValues``
7+
8+
### Layout
9+
10+
- ``EnvironmentValues/layoutOrientation``
11+
- ``Orientation``
12+
- ``EnvironmentValues/layoutAlignment``
13+
- ``StackAlignment``
14+
15+
### Actions
16+
17+
- ``EnvironmentValues/openURL``
18+
- ``OpenURLAction``
19+
20+
- ``EnvironmentValues/revealFile``
21+
- ``RevealFileAction``
22+
23+
- ``EnvironmentValues/chooseFileSaveDestination``
24+
- ``PresentFileSaveDialogAction``
25+
- ``SaveDialogOptions``
26+
- ``ContentType``
27+
28+
- ``EnvironmentValues/chooseFile``
29+
- ``FileDialogOptions``
30+
- ``OpenDialogOptions``
31+
- ``PresentSingleFileOpenDialogAction``
32+
- ``FileChooserResult``
33+
34+
- ``EnvironmentValues/presentAlert``
35+
- ``PresentAlertAction``
36+
- ``AlertAction``
37+
- ``AlertActionsBuilder``
38+
39+
### Custom environment values
40+
41+
- ``EnvironmentKey``

0 commit comments

Comments
 (0)