Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New layout system and much much more! #102

Merged
merged 161 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
562fa3b
Create note-taking example with basic state persistence (and add dyna…
stackotter Jul 30, 2024
ce63238
Fix GtkCodeGen, create manual wrapper for GtkFixed and fix SignalBox …
stackotter Jul 30, 2024
fdfdeb0
Add pango and pango-cairo, and implement a text layout utility functi…
stackotter Jul 30, 2024
c707db4
Remove appIdentifier requirement from App protocol (it was only used …
stackotter Jul 30, 2024
0700409
Implement start of new layout system (only AppKit works so far, and a…
stackotter Aug 1, 2024
22e8757
Implement window resize handling (for new layout system)
stackotter Aug 2, 2024
32e40bd
Implement VStack and HStack alignment (super simple under the new lay…
stackotter Aug 2, 2024
5eb8279
Implement bottom-up updates (caused when a child updates) and basic e…
stackotter Aug 6, 2024
e8be376
Reimplement EitherView
stackotter Aug 6, 2024
f050337
Reimplement OptionalView
stackotter Aug 6, 2024
d8c7bec
Reimplement ForEach view
stackotter Aug 6, 2024
fe9e7a5
Create Group view and pass down alignment and spacing via environment…
stackotter Aug 6, 2024
010ed5b
Reimplement ScrollView, Picker, Slider, TextField, Toggle, ToggleButt…
stackotter Aug 6, 2024
4f74562
Reimplement HotReloadableView under new layout system (kind of... sti…
stackotter Aug 6, 2024
fa5314b
Reimplement NavigationStack under new layout system and fix EitherVie…
stackotter Aug 6, 2024
52a20f5
Reimplement NavigationSplitView under new layout system (still have t…
stackotter Aug 8, 2024
5e340d0
Reimplement padding modifiers under new layout system
stackotter Aug 8, 2024
5c5d8c8
Reimplement frame modifiers under new layout system (now able to do m…
stackotter Aug 8, 2024
4b8c276
Refactor View protocol's update method to return minimum width and he…
stackotter Aug 31, 2024
8c554ca
Properly implement window resizability modes using new layout system …
stackotter Aug 31, 2024
c032c6e
Reimplement foregroundColor modifier under new layout system (much be…
stackotter Aug 31, 2024
76704b2
Allow backends to modify the root-level environment (e.g. to handle s…
stackotter Aug 31, 2024
1624795
Reimplement Image view under new layout system using swift-image-form…
stackotter Sep 3, 2024
83fb0a5
Fix handling of window resizing and view updates that cause window re…
stackotter Sep 3, 2024
64eeadc
Fix layout of Text when proposed width is 0 under AppKitBackend
stackotter Sep 3, 2024
f3d438b
Fix SplitView layout during window resizing under AppKitBackend
stackotter Sep 3, 2024
f375400
Reimplement tables under new layout system and allow cells to contain…
stackotter Sep 8, 2024
4083e4e
Rename VariadicViewN to TupleViewN and ViewGraphNodeChildrenN to Tupl…
stackotter Sep 8, 2024
e4d3631
Query table row height, table cell padding, and text line height from…
stackotter Sep 8, 2024
4cab619
Revert AppKitBackend.Widget to be a simple typealias to NSView again
stackotter Sep 9, 2024
15e380f
Allow backends to update the root environment at any time (allows app…
stackotter Sep 9, 2024
42ab219
Adapt text color of Button labels and Table column labels to obey the…
stackotter Sep 9, 2024
562c723
Generate TupleSceneN's from 2 up to 10, finally allowing creating mor…
stackotter Sep 9, 2024
282109d
Update examples to use DefaultBackend and update backend list in READ…
stackotter Sep 9, 2024
81b5673
Add Tomas Linhart's license to the portion of the Gtk wrapper copied …
stackotter Sep 9, 2024
29bfb70
Update GtkBackend to compile again with new layout system; no Table o…
stackotter Sep 12, 2024
63a505d
GtkBackend: Use environment-specific pango instance for text layout, …
stackotter Sep 12, 2024
0baf710
Fix AppKitBackend compilation issue
stackotter Sep 13, 2024
18339be
Update macOS GitHub action to Xcode 15.4 and remove generated Gtk enu…
stackotter Sep 14, 2024
b1c4af2
Fix GtkBackend compilation on Linux by unwrapping pixel data pointer …
stackotter Sep 14, 2024
cf52a20
Update Pango wrapper to hopefully free contexts and layouts correctly…
stackotter Sep 14, 2024
afa3486
List available Xcode versions in macOS GitHub Actions workflow
stackotter Sep 14, 2024
d86dfd7
Update macOS GitHub Actions workflow to macOS 14 to use Xcode 15.4 an…
stackotter Sep 14, 2024
53df137
Try removing libffi patch after updating to macOS 14 (hopefully it is…
stackotter Sep 14, 2024
e6a6fb4
Disable 'Test' step in macOS GitHub Actions workflow again (because i…
stackotter Sep 14, 2024
24d7f90
Introduce new AppBackend method to help GtkBackend keep window childr…
stackotter Sep 14, 2024
31a5f08
Implement updateSplitViewChildPositions for AppKitBackend and add *.t…
stackotter Sep 14, 2024
c4b3a68
Implement a custom Gtk widget to provide the fine-grained window size…
stackotter Sep 16, 2024
083c0d4
Avoid creating unnecessary empty transform when propagating Gtk size …
stackotter Sep 16, 2024
d1fff68
Fix TextField layout, ScrollView/TupleView flexibility, and AppKitBac…
stackotter Sep 16, 2024
97e548b
Implement ScrollView support for GtkBackend
stackotter Sep 16, 2024
bfc014d
AppKitBackend: Remove default AppKit scroll view background
stackotter Sep 16, 2024
7be1afa
Update SplitView to use the same new child centering approach as Wind…
stackotter Sep 17, 2024
0d1178c
Allow a backend-specific default padding amount to be used when using…
stackotter Sep 17, 2024
98497e9
Added another variant of the View.padding(_:_:) modifier cause overlo…
stackotter Sep 17, 2024
b57bd61
Remove concept of View flexibility and instead allow computing the si…
stackotter Sep 23, 2024
8aa6cf5
Fix child layout order for stack layouts (accidentally had it backwards)
stackotter Sep 23, 2024
4e65a58
Cache view sizes during updates to make view updates linear with node…
stackotter Sep 23, 2024
ec8ef48
Use dry-run updates to optimise bottom-up updates and top-level updates
stackotter Sep 23, 2024
9f8256a
Update all views to compute maximum dimensions, allowing for stack la…
stackotter Sep 23, 2024
1f565dd
Implement View protocol for Color
stackotter Sep 23, 2024
44bee62
Disable linter rule causing error
stackotter Sep 23, 2024
7745acd
Implement ZStack view
stackotter Sep 24, 2024
353611a
Implement View.background(_:) modifier
stackotter Sep 24, 2024
48290ae
Update ScrollView to take scroll bar widths into account during layou…
stackotter Sep 24, 2024
fdb4d03
Implement View.cornerRadius(_:) modifier and fix Color's dryRun updat…
stackotter Sep 24, 2024
f8d08c6
Implement ProgressView, only supporting indeterminate spinners for now
stackotter Sep 24, 2024
55ac80f
Implement View.font(_:) modifier with options for font size, weight a…
stackotter Sep 24, 2024
e591b01
Refactor to get rid of 'currentBackend' global variable
stackotter Sep 24, 2024
6738ff5
Improve computed view size caching (reducing updates per node by some…
stackotter Sep 25, 2024
0de8f2d
Bump to swift-image-formats with debug mode optimisations, and only u…
stackotter Sep 25, 2024
2b0abd3
Fix new split view resizing behaviour to still avoid putting the side…
stackotter Sep 25, 2024
6532df9
Fix ScrollView layout
stackotter Sep 25, 2024
23f92c1
Implement alignment of frame children
stackotter Nov 17, 2024
bc5cba4
Fix over-eager layout size caching
stackotter Nov 17, 2024
498b8b3
Introduce concept of hidden views, ignore them when spacing stack chi…
stackotter Nov 18, 2024
548125f
Style TextField text to match foregroundColor when using GtkBackend
stackotter Nov 18, 2024
2bcbb78
Fix weird text layout behaviour with GtkBackend, never tell Pango the…
stackotter Nov 18, 2024
720ae93
Implement multilineTextAlignment modifier (for GtkBackend and AppKitB…
stackotter Nov 18, 2024
8a53df4
Stop empty stacks ending up with negative spacing (which led to negat…
stackotter Nov 18, 2024
9b6f990
Fix GtkBackend text layout issue causing dry run size to differ from …
stackotter Nov 18, 2024
abfaad4
Fix accidentally inverted condition (for Group stack layout participa…
stackotter Nov 18, 2024
057ac4f
Fix compilation error encountered by GitHub Actions macOS workflow
stackotter Nov 18, 2024
78ddea3
Fix compilation error encountered by GitHub Actions macOS workflow ma…
stackotter Nov 18, 2024
608cc3b
Copy and adapt existing Gtk wrapper to create a Gtk3 wrapper (for sup…
stackotter Nov 19, 2024
e23a6d5
Create a Gtk3Backend for legacy systems
stackotter Nov 19, 2024
3e1be70
Fix window resizing for Gtk3Backend with custom widget and hours of d…
stackotter Nov 19, 2024
1da01c3
Replace G_DEFINE_FINAL_TYPE with G_DEFINE_TYPE to support older glib …
stackotter Nov 19, 2024
5c89d3e
Create colorScheme modifier to allow users to override system color s…
stackotter Nov 20, 2024
b8fb86a
Replace @retroactive annotation with fully qualified type name of pro…
stackotter Nov 20, 2024
a25cca5
Implement progress bars (used by ProgressView when using any of the n…
stackotter Nov 20, 2024
27f5057
Fix weird Gtk3Backend rendering glitch (tracking down the cause was s…
stackotter Nov 20, 2024
cadf5b8
Add cross reference permalink to Gtk 3 button explanation to future-p…
stackotter Nov 20, 2024
e59d91e
Introduce explicit state update queueing logic to avoid queuing unnec…
stackotter Nov 20, 2024
deb2b5e
Fix Gtk enum property types for older Gtk 3 versions
stackotter Nov 21, 2024
55ff38a
Add state update merging to _App (a bit of an oversight, I originally…
stackotter Nov 21, 2024
eab21cb
Greatly simplify state update merging implementation with a semaphore…
stackotter Nov 21, 2024
6228bd5
Sleep between UI updates when needed to avoid main thread saturation
stackotter Nov 21, 2024
5b7beed
Implement Menu view (a button which triggers a pop-up menu containing…
stackotter Nov 23, 2024
df2b4e5
Update to swift-image-formats v0.2.0
stackotter Dec 2, 2024
a23c437
Use idealSize of content for contentSize windows, fix idealSize propa…
stackotter Dec 6, 2024
cebd011
Fix GtkBackend's colorableRectangle, sometimes required a few updates…
stackotter Dec 6, 2024
629ad25
Fix GtkBackend window resizing (delay handler to not mess with Gtk re…
stackotter Dec 6, 2024
eeaa898
Update ProgressView to take any BinaryFloatingPoint (not just Double)
stackotter Dec 6, 2024
7dd337a
Implement Scene.commands modifier for configuring menu bar items
stackotter Dec 10, 2024
d348bad
Revert accidentally committed CounterApp changes (from local testing)
stackotter Dec 10, 2024
28a2db7
Update Menu to support nested submenus, backends now reuse menubar code
stackotter Dec 10, 2024
95aaf07
Update MenuItemsBuilder to support optional and either blocks
stackotter Dec 10, 2024
052cd68
Implement .alert view modifier (AppKit, Gtk 4, Gtk 3)
stackotter Dec 12, 2024
fed7ceb
Impl @Environment property wrapper, impl file open/save dialog support
stackotter Dec 14, 2024
2644ee1
Create presentAlert env action, don't allow env action access from App
stackotter Dec 14, 2024
0f2d23d
Update modal impls to work outside of scenes (falling back to app modal)
stackotter Dec 14, 2024
d94e00a
Implement onAppear and onDisappear view modifiers
stackotter Dec 14, 2024
60c2c3c
Impl onChange+task modifiers, fix onAppear+onDisappear modifiers
stackotter Dec 14, 2024
57a53ed
Debug runaway window update recursion, impl menu ForEach support
stackotter Dec 14, 2024
9cd4256
Implement temporary _buttonWidth modifier for Buttons and Menus
stackotter Dec 14, 2024
f0107f9
Impl Color.opacity(_:) and Color.clear from SwiftUI (#95)
bbrk24 Dec 14, 2024
aaa935c
Implement View.bold() modifier
stackotter Dec 14, 2024
82aa7db
Implement onClick modifier (AppKit, Gtk4, Gtk3)
stackotter Dec 16, 2024
aff908a
Implement onSubmit and submitScope modifiers for TextField handling
stackotter Dec 16, 2024
352c2ce
Chain onSubmit handlers (running outermost ones first to match SwiftUI)
stackotter Dec 16, 2024
f942fec
Impl preference and onOpenURL modifiers (pref required prefs system)
stackotter Dec 17, 2024
e237115
Introduce app metadata system, default to parsing Swift Bundler metadata
stackotter Dec 17, 2024
0b56815
Fix window sizing issue, fix view hiding, bring window to front on URL
stackotter Dec 20, 2024
3c81d6e
Change text cursor color and progress bar bg color based on color scheme
stackotter Dec 23, 2024
73a101b
Parse new Swift Bundler additionalMetadata field when present in binary
stackotter Dec 23, 2024
eea0ead
Switch to swift-winui and swift-windowsappsdk with ARM64 fixes (PR #96)
stackotter Jan 3, 2025
f8bfe27
Implement basics of WinUIBackend under new layout system (RNG ex works)
stackotter Jan 7, 2025
4b82aa2
Fix window resizing (stale scene) + impl Image support in WinUIBackend
stackotter Jan 7, 2025
9e58521
Implement WinUIBackend SplitView and text wrapping support
stackotter Jan 7, 2025
9961828
Implement WinUIBackend Toggle support
stackotter Jan 7, 2025
baf48b3
Impl WinUIBackend ScrollView, fix ScrollView layout calculations
stackotter Jan 8, 2025
0727f78
Update default WinUIBackend slider step, add slider to ControlsExample
stackotter Jan 8, 2025
4851b21
Update to swift-image-formats 0.3.0 for faster PNG decode/encode
stackotter Jan 9, 2025
a6930b2
Update swift-syntax dependency, remove unsupported backends
stackotter Jan 9, 2025
c1b964f
WinUIBackend: Figure out how to read resource dictionary property values
stackotter Jan 9, 2025
1f0092a
Introduce @State property wrapper based state management (breaking)
stackotter Jan 9, 2025
d2dd03a
AppKitBackend: Add default main menu items (#97)
furby-tm Jan 9, 2025
63fde71
Rename Observable to ObservableObject and Observed to Published
stackotter Jan 9, 2025
5533e4a
Implement UIKitBackend to support iOS, tvOS and catalyst (#98)
bbrk24 Jan 13, 2025
66a6df7
AppKitBackend: Fix Color to NSColor conversion (missing alpha)
stackotter Jan 9, 2025
5069fc4
Implement Divider view
stackotter Jan 9, 2025
e2bbfdd
Add file dialogs, alerts, and menu items to WindowingExample
stackotter Jan 9, 2025
9ff90d6
Fix ZStack widget size (fixes onClick in ZStacks)
stackotter Jan 12, 2025
9faf0fe
Implement View.overlay(content:) modifier
stackotter Jan 12, 2025
37cf136
Implement ZStack alignment
stackotter Jan 12, 2025
bc8f318
Reuse view update results when views are fixed size
stackotter Jan 13, 2025
36c3e56
Impl View.if and View.ifLet conditional modifier application modifiers
stackotter Jan 13, 2025
f5df8b0
Implement WinUIBackend alert support
stackotter Jan 13, 2025
fbc952f
Fix View.background modifier maximum size calculation
stackotter Jan 13, 2025
d33184b
Fix WindowGroupNode update performance (inverted condition)
stackotter Jan 13, 2025
8c6bf77
Fix Toggle compilation, add OS versions to Examples/Package.swift
stackotter Jan 13, 2025
f46e952
Fix Button actions and fg color on tvOS
stackotter Jan 13, 2025
1507ea4
Remove UIKitBackend file headers (generated by Xcode)
stackotter Jan 13, 2025
57ede1e
Fix UIKitBackend onOpenURL, fix WindowGroupNode windowSizeIsFinal logic
stackotter Jan 13, 2025
526df1a
Impl corner radius and click target support for WinUIBackend
stackotter Jan 15, 2025
e1f3d16
Update to swift-image-formats 0.3.1 for Windows bug fixes
stackotter Jan 15, 2025
2fef599
Update backend documentation in README.md
stackotter Jan 15, 2025
ad383d6
Update GitHub Actions workflows to run on PRs to all branches
stackotter Jan 15, 2025
f55186c
Implement Picker for tvOS & Mac Catalyst (#99)
bbrk24 Jan 15, 2025
f5cc3fe
Fix value type State restoration, sync the box not the value (#101?)
stackotter Jan 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .github/workflows/swift-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ name: Build Linux

on:
push:
branches-ignore:
- 'gh-pages'
pull_request:
branches: [ main ]
branches-ignore:
- 'gh-pages'

jobs:
build-linux:
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/swift-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ name: Build macOS

on:
push:
branches-ignore:
- 'gh-pages'
pull_request:
branches: [ main ]
branches-ignore:
- 'gh-pages'

jobs:
build-mac:
runs-on: macos-13
runs-on: macos-14
steps:
- name: Force Xcode 15.0
run: sudo xcode-select -switch /Applications/Xcode_15.0.app
- name: Force Xcode 15.4
run: sudo xcode-select -switch /Applications/Xcode_15.4.app
- uses: actions/checkout@v3
- name: Install Dependencies
run: brew install pkg-config gtk4 || echo "This step 'fails' every time but it's just a brew linking error - not important."
- name: Patch libffi
run: sed -i '' 's/-I..includedir.//g' /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/13/libffi.pc
- name: Build
run: |
swift build --target GtkCodeGen && \
Expand All @@ -30,5 +31,7 @@ jobs:
swift build --target NavigationExample && \
swift build --target SplitExample && \
swift build --target GtkExample
# Calling `swift test` results in all targets getting built including targets such as WinUIBackend which
# aren't available on macOS.
# - name: Test
# run: swift test
5 changes: 4 additions & 1 deletion .github/workflows/swift-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ name: Build Windows

on:
push:
branches-ignore:
- 'gh-pages'
pull_request:
branches: [ main ]
branches-ignore:
- 'gh-pages'

jobs:
build-windows:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches-ignore:
- 'gh-pages'

pull_request:
branches-ignore:
- 'gh-pages'
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
/.build
/.index-build
/Examples/.build
/Packages
/*.xcodeproj
Expand All @@ -9,4 +10,5 @@ DerivedData/
/.vscode
*.pyc
/.swiftpm
vcpkg_installed/
vcpkg_installed/
*.trace
9 changes: 7 additions & 2 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ disabled_rules:
- trailing_comma # Conflicts with swift-format
- file_length
- force_cast # Required a lot in backend implementations
- function_body_length

line_length: 140
type_body_length: 400
Expand All @@ -18,8 +19,12 @@ included:
- Sources
- Examples
excluded:
- Sources/SwiftCrossUI/ViewGraph/ViewGraphNodeChildren.swift
- Sources/SwiftCrossUI/Builders/ViewBuilder.swift
- Sources/SwiftCrossUI/Views/VariadicView.swift
- Sources/SwiftCrossUI/Builders/SceneBuilder.swift
- Sources/SwiftCrossUI/Builders/TableRowBuilder.swift
- Sources/SwiftCrossUI/Views/TupleView.swift
- Sources/SwiftCrossUI/Views/TupleViewChildren.swift
- Sources/SwiftCrossUI/Views/TableRowContent.swift
- Sources/SwiftCrossUI/Scenes/TupleScene.swift
- Sources/Gtk/Generated
- Examples/.build
13 changes: 9 additions & 4 deletions Examples/Bundler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ product = 'CounterExample'
version = '0.1.0'

[apps.RandomNumberGeneratorExample]
identifier = 'dev.stackotter.RandomNumberGeneratorE'
product = 'RandomNumberGeneratorE'
identifier = 'dev.stackotter.RandomNumberGeneratorExample'
product = 'RandomNumberGeneratorExample'
version = '0.1.0'

[apps.WindowingExample]
Expand All @@ -21,8 +21,8 @@ product = 'WindowingExample'
version = '0.1.0'

[apps.GreetingGeneratorExample]
identifier = 'dev.stackotter.GreetingGeneratorExamp'
product = 'GreetingGeneratorExamp'
identifier = 'dev.stackotter.GreetingGeneratorExample'
product = 'GreetingGeneratorExample'
version = '0.1.0'

[apps.NavigationExample]
Expand All @@ -44,3 +44,8 @@ version = '0.1.0'
identifier = 'dev.stackotter.StressTestExample'
product = 'StressTestExample'
version = '0.1.0'

[apps.NotesExample]
identifier = 'dev.stackotter.NotesExample'
product = 'NotesExample'
version = '0.1.0'
Loading
Loading