-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic UIHostingView support (#53)
* Add UIHostingView * Update Time and UIHostingView * Move File location * Add basic ViewGraph support * Update ViewRendererHost implementation * Update UIHostingView's updateOutputs * Update VIew Layout related implementation * Fix Linux build issue
- Loading branch information
Showing
36 changed files
with
993 additions
and
122 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,24 @@ | ||
// | ||
// ScenePhase.swift | ||
// OpenSwiftUI | ||
// | ||
// Audited for RELEASE_2021 | ||
// Status: WIP | ||
// ID: 130BB08D98602D712FD59CAC6992C14A | ||
|
||
public enum ScenePhase: Comparable, Hashable { | ||
case background | ||
case inactive | ||
case active | ||
} | ||
|
||
private struct ScenePhaseKey: EnvironmentKey { | ||
static let defaultValue: ScenePhase = .background | ||
} | ||
|
||
extension EnvironmentValues { | ||
public var scenePhase: ScenePhase { | ||
get { self[ScenePhaseKey.self] } | ||
set { self[ScenePhaseKey.self] = newValue } | ||
} | ||
} |
33 changes: 0 additions & 33 deletions
33
Sources/OpenSwiftUI/Core/Data/EnvironmentKeys/ColorSchemeKey.swift
This file was deleted.
Oops, something went wrong.
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,68 @@ | ||
// | ||
// DisplayLink.swift | ||
// OpenSwiftUI | ||
// | ||
// Audited for RELEASE_2021 | ||
// Status: WIP | ||
// ID: D912470A6161D66810B373079EE9F26A | ||
|
||
#if canImport(Darwin) && os(iOS) // Disable macOS temporary due to CADisplayLink issue | ||
import QuartzCore | ||
#if os(iOS) | ||
import UIKit | ||
#elseif os(macOS) | ||
import AppKit | ||
#endif | ||
|
||
final class DisplayLink: NSObject { | ||
private weak var host: AnyUIHostingView? | ||
private var link: CADisplayLink? | ||
private var nextUpdate: Time | ||
private var currentUpdate: Time? | ||
private var interval: Double | ||
private var reasons: Set<UInt32> | ||
private var currentThread: ThreadName | ||
private var nextThread: ThreadName | ||
|
||
#if os(iOS) | ||
init(host: AnyUIHostingView, window: UIWindow) { | ||
fatalError("TODO") | ||
} | ||
#elseif os(macOS) | ||
init(host: AnyUIHostingView, window: NSWindow) { | ||
fatalError("TODO") | ||
} | ||
#endif | ||
|
||
var willRender: Bool { | ||
nextUpdate < .infinity | ||
} | ||
|
||
func setNextUpdate(delay: Double, interval: Double, reasons: Set<UInt32>) { | ||
// TODO | ||
} | ||
|
||
func invalidate() { | ||
Update.lock.withLock { | ||
// TODO | ||
} | ||
} | ||
|
||
@inline(__always) | ||
func startAsyncRendering() { | ||
nextThread = .async | ||
} | ||
|
||
@inline(__always) | ||
func cancelAsyncRendering() { | ||
nextThread = .main | ||
} | ||
} | ||
|
||
extension DisplayLink { | ||
enum ThreadName: Hashable { | ||
case main | ||
case async | ||
} | ||
} | ||
#endif |
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.