-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65e78a0
commit b4f319b
Showing
57 changed files
with
1,505 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// UIViewTestScene.swift | ||
// | ||
// | ||
// Created by Vladislav Prusakov on 07.06.2024. | ||
// | ||
|
||
import AdaEngine | ||
|
||
struct ContentWidget: Widget { | ||
|
||
@WidgetContext(\.font) private var font | ||
|
||
@State private var int = 0 | ||
@State private var double = 0.0 | ||
|
||
var body: some Widget { | ||
HStack { | ||
Text("Hello World") | ||
|
||
CustomWidget() | ||
|
||
Text("Hello World") | ||
|
||
} | ||
|
||
Text("Hello World") | ||
} | ||
} | ||
|
||
struct CustomWidget: Widget { | ||
|
||
@State private var string = "" | ||
|
||
var body: some Widget { | ||
Text("Hello World") | ||
|
||
Text("Hello World") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
Sources/AdaEngine/Application/AppCreate/Scenes/WidgetGroup.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// WidgetGroup.swift | ||
// AdaEngine | ||
// | ||
// Created by Vladislav Prusakov on 08.06.2024. | ||
// | ||
|
||
public struct WidgetGroup<Content: Widget>: AppScene { | ||
|
||
public var scene: Never { fatalError() } | ||
|
||
let content: Content | ||
|
||
public init(@WidgetBuilder content: () -> Content) { | ||
self.content = content() | ||
} | ||
} | ||
|
||
extension WidgetGroup: InternalAppScene { | ||
@MainActor | ||
func _makeWindow(with configuration: _AppSceneConfiguration) async throws -> UIWindow { | ||
let frame = Rect(origin: .zero, size: configuration.minimumSize) | ||
let window = UIWindow(frame: frame) | ||
|
||
let gameSceneView = UIWidgetView(rootView: self.content) | ||
window.addSubview(gameSceneView) | ||
|
||
window.setWindowMode(configuration.windowMode) | ||
window.minSize = configuration.minimumSize | ||
|
||
if let title = configuration.title { | ||
window.title = title | ||
} | ||
|
||
return window | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.