Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Add widgets and demo application
Browse files Browse the repository at this point in the history
  • Loading branch information
david-swift committed Sep 26, 2023
1 parent 2611e0c commit cbbf08b
Show file tree
Hide file tree
Showing 40 changed files with 1,143 additions and 173 deletions.
8 changes: 0 additions & 8 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,6 @@ custom_rules:
message: 'Spaces should be used instead of tabs.'
severity: warning

string_literals:
name: 'String Literals'
regex: '(".*")|("""(.|\n)*""")'
message: 'String literals should not be used. Disable this rule in String and LocalizedStringResource extensions.'
match_kinds:
- string
severity: warning

# Thanks to the creator of the SwiftLint rule
# "empty_first_line"
# https://github.com/coteditor/CotEditor/blob/main/.swiftlint.yml
Expand Down
7 changes: 7 additions & 0 deletions Documentation/Reference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@
- [Binding](structs/Binding.md)
- [Button](structs/Button.md)
- [EitherView](structs/EitherView.md)
- [HStack](structs/HStack.md)
- [HeaderBar](structs/HeaderBar.md)
- [InspectorWrapper](structs/InspectorWrapper.md)
- [List](structs/List.md)
- [NavigationSplitView](structs/NavigationSplitView.md)
- [ScrollView](structs/ScrollView.md)
- [State](structs/State.md)
- [StateWrapper](structs/StateWrapper.md)
- [StatusPage](structs/StatusPage.md)
- [Text](structs/Text.md)
- [ToolbarView](structs/ToolbarView.md)
- [UpdateObserver](structs/UpdateObserver.md)
- [VStack](structs/VStack.md)
- [Window](structs/Window.md)
Expand Down
2 changes: 1 addition & 1 deletion Documentation/Reference/classes/ViewStorage.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The view's content.

### `state`

The view's state (used in `VStack`).
The view's state (used in `StateWrapper`).

## Methods
### `init(_:content:state:)`
Expand Down
5 changes: 5 additions & 0 deletions Documentation/Reference/extensions/Array.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

# `Array`

## Properties
### `view`

The array's view body is the array itself.

## Methods
### `widget()`

Expand Down
4 changes: 4 additions & 0 deletions Documentation/Reference/extensions/String.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ A label for main content in a view storage.
### `transition`

A label for the transition data in a GTUI widget's fields.

### `navigationLabel`

A label for the navigation label in a GTUI widget's fields.
46 changes: 46 additions & 0 deletions Documentation/Reference/extensions/View.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ Enable or disable the vertical expansion.
- Parameter enabled: Whether it is enabled or disabled.
- Returns: A view.

### `halign(_:)`

Set the horizontal alignment.
- Parameter align: The alignment.
- Returns: A view.

### `valign(_:)`

Set the vertical alignment.
- Parameter align: The alignment.
- Returns: A view.

### `frame(minWidth:minHeight:)`

Set the view's minimal width or height.
Expand All @@ -64,6 +76,40 @@ Set the view's transition.
- Parameter transition: The transition.
- Returns: A view.

### `navigationTitle(_:)`

Set the view's navigation title.
- Parameter label: The navigation title.
- Returns: A view.

### `style(_:)`

Add a style class to the view.
- Parameter style: The style class.
- Returns: A view.

### `onAppear(_:)`

Run a function when the view appears for the first time.
- Parameter closure: The function.
- Returns: A view.

### `topToolbar(visible:_:)`

Add a top toolbar to the view.
- Parameters:
- toolbar: The toolbar's content.
- visible: Whether the toolbar is visible.
- Returns: A view.

### `bottomToolbar(visible:_:)`

Add a bottom toolbar to the view.
- Parameters:
- toolbar: The toolbar's content.
- visible: Whether the toolbar is visible.
- Returns: A view.

### `onUpdate(_:)`

Run a function when the view gets an update.
Expand Down
26 changes: 26 additions & 0 deletions Documentation/Reference/structs/HStack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
**STRUCT**

# `HStack`

A horizontal GtkBox equivalent.

## Properties
### `content`

The content.

## Methods
### `init(content:)`

Initialize a `HStack`.
- Parameter content: The view content.

### `update(_:)`

Update a view storage.
- Parameter storage: The view storage.

### `container()`

Get a view storage.
- Returns: The view storage.
46 changes: 46 additions & 0 deletions Documentation/Reference/structs/List.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
**STRUCT**

# `List`

A list box widget.

## Properties
### `elements`

The elements.

### `content`

The content.

### `selection`

The identifier of the selected element.

## Methods
### `init(_:selection:content:)`

Initialize `ForEach`.
- Parameters:
- elements: The elements.
- selection: The identifier of the selected element.
- content: The view for an element.

### `update(_:)`

Update a view storage.
- Parameter storage: The view storage.

### `container()`

Get a view storage.
- Returns: The view storage.

### `updateSelection(box:)`

Update the list's selection.
- Parameter box: The list box.

### `sidebarStyle()`

Add the "navigation-sidebar" style class.
40 changes: 40 additions & 0 deletions Documentation/Reference/structs/NavigationSplitView.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
**STRUCT**

# `NavigationSplitView`

A navigation split view widget.

## Properties
### `sidebar`

The sidebar's content.

### `content`

The split view's main content.

### `sidebarID`

The sidebar content's id.

### `contentID`

The main content's id.

## Methods
### `init(sidebar:content:)`

Initialize a navigation split view.
- Parameters:
- sidebar: The sidebar content.
- content: The main content.

### `container()`

Get the container of the navigation split view widget.
- Returns: The view storage.

### `update(_:)`

Update the view storage of the navigation split view widget.
- Parameter storage: The view storage.
26 changes: 26 additions & 0 deletions Documentation/Reference/structs/ScrollView.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
**STRUCT**

# `ScrollView`

A GtkScrolledWindow equivalent.

## Properties
### `content`

The content.

## Methods
### `init(content:)`

Initialize a `ScrollView`.
- Parameter content: The view content.

### `update(_:)`

Update a view storage.
- Parameter storage: The view storage.

### `container()`

Get a view storage.
- Returns: The view storage.
37 changes: 37 additions & 0 deletions Documentation/Reference/structs/StateWrapper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
**STRUCT**

# `StateWrapper`

A storage for `@State` properties.

## Properties
### `content`

The content.

### `state`

The state information (from properties with the `State` wrapper).

## Methods
### `init(content:)`

Initialize a `StateWrapper`.
- Parameter content: The view content.

### `init(content:state:)`

Initialize a `StateWrapper`.
- Parameters:
- content: The view content.
- state: The state information.

### `update(_:)`

Update a view storage.
- Parameter storage: The view storage.

### `container()`

Get a view storage.
- Returns: The view storage.
42 changes: 42 additions & 0 deletions Documentation/Reference/structs/StatusPage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
**STRUCT**

# `StatusPage`

A status page widget.

## Properties
### `title`

The title.

### `description`

The description.

### `icon`

The icon.

### `content`

Additional content.

## Methods
### `init(_:icon:description:content:)`

Initialize a status page widget.
- Parameters:
- title: The title.
- icon: The icon.
- description: Additional details.
- content: Additional content.

### `update(_:)`

Update the view storage of the text widget.
- Parameter storage: The view storage.

### `container()`

Get the container of the text widget.
- Returns: The view storage.
37 changes: 37 additions & 0 deletions Documentation/Reference/structs/ToolbarView.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
**STRUCT**

# `ToolbarView`

A toolbar view widget.

## Properties
### `content`

The sidebar's content.

### `toolbar`

The toolbars.

### `bottom`

Whether the toolbars are bottom toolbars.

### `visible`

Whether the toolbar is visible.

### `toolbarID`

The identifier of the toolbar content.

## Methods
### `container()`

Get the container of the toolbar view widget.
- Returns: The view storage.

### `update(_:)`

Update the view storage of the toolbar view widget.
- Parameter storage: The view storage.
Loading

0 comments on commit cbbf08b

Please sign in to comment.