Skip to content

Commit 2fef599

Browse files
committed
Update backend documentation in README.md
1 parent e1f3d16 commit 2fef599

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

Examples/Sources/WindowingExample/WindowingApp.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ struct AlertDemo: View {
6969
struct WindowingApp: App {
7070
@State var title = "My window"
7171
@State var resizable = false
72-
@State var errorMessage: String? = nil
7372

7473
var body: some Scene {
7574
WindowGroup(title) {

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ SwiftCrossUI has a variety of backends tailored to different operating systems.
3131
If you use `DefaultBackend`, like the examples do, you can override the default when compiling your app by setting the `SCUI_DEFAULT_BACKEND` environment variable to the name of your desired backend. This can be quite useful when you e.g. want to test the Gtk version of your app while using a Mac.
3232

3333
- `DefaultBackend`: Adapts to your target operating system. On macOS it uses `AppKitBackend`, on Windows it uses `WinUIBackend`, on Linux it uses `GtkBackend`, and on iOS and tvOS it uses `UIKitBackend`.
34-
- `GtkBackend`: Works on Linux, macOS, and Windows. Requires gtk 4 to be installed. Supports all SwiftCrossUI features.
3534
- `AppKitBackend`: The native macOS backend. Supports all SwiftCrossUI features.
36-
- `WinUIBackend`: The native Windows backend. Supports most SwiftCrossUI features.
3735
- `UIKitBackend`: The native iOS & tvOS backend. Supports most SwiftCrossUI features.
38-
- `QtBackend`: ***Experimental***, requires `qt5` to be installed, and currently supports a very limited subset of SwiftCrossUI features.
39-
- `CursesBackend`: ***Experimental***, requires `curses` to be installed, and supports a *very very* limited subset of SwiftCrossUI features.
36+
- `WinUIBackend`: The native Windows backend. Supports most SwiftCrossUI features.
37+
- `GtkBackend`: Works on Linux, macOS, and Windows. Requires gtk 4 to be installed. Supports most SwiftCrossUI features.
38+
- `Gtk3Backend`: Exists to target older Linux distributions. Requires gtk 3 to be installed. Supports most SwiftCrossUI features. Quite buggy on macOS because Gtk 3 itself doesn't support macOS very well.
4039

4140
## Example
4241

@@ -49,9 +48,11 @@ import DefaultBackend
4948

5049
@main
5150
struct CounterApp: App {
52-
// Optionally, you can explicitly select which imported backend to use (if you only
53-
// import one backend then this is done automatically).
54-
// typealias Backend = DefaultBackend
51+
// You can explicitly provide your selected backend to SwiftCrossUI if you
52+
// want extra control. This allows you to configure the backend if the
53+
// backend has alternative initializers.
54+
//
55+
// var backend = DefaultBackend()
5556

5657
@State var count = 0
5758

Sources/SwiftCrossUI/Backend/AppBackend.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public protocol AppBackend {
4545
associatedtype Menu
4646
associatedtype Alert
4747

48+
/// Creates an instance of the backend.
49+
init()
50+
4851
/// The default height of a table row excluding cell padding. This is a
4952
/// recommendation by the backend that SwiftCrossUI won't necessarily
5053
/// follow in all cases.

Sources/UIKitBackend/UIKitBackend.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public final class UIKitBackend: AppBackend {
1919
public let defaultTableRowContentHeight = -1
2020
public let defaultTableCellVerticalPadding = -1
2121

22+
public init() {}
23+
2224
var onTraitCollectionChange: (() -> Void)?
2325
public func runMainLoop(
2426
_ callback: @escaping () -> Void

0 commit comments

Comments
 (0)