Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Example/HostingExample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ class ViewController: NSViewController {

struct ContentView: View {
var body: some View {
AnimatedColorTimelineView()
ToggleExample()
}
}
25 changes: 25 additions & 0 deletions Example/SharedExample/View/ToggleExample.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// ToggleExample.swift
// SharedExample

#if OPENSWIFTUI
import OpenSwiftUI
#else
import SwiftUI
#endif

struct ToggleExample: View {
// FIXME: Fix Representable update logic and add test case
@State var toggle = false

var body: some View {
Toggle(isOn: $toggle) {
Color.red
}
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
toggle.toggle()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ import OpenSwiftUICore
#if canImport(Darwin)
@objc
#endif
class PlatformViewCoordinator: NSObject {}

// TODO: weakDispatchUpdate
class PlatformViewCoordinator: NSObject {
var weakDispatchUpdate: (() -> Void) -> Void {
{ [weak self] update in
guard let self else {
update()
return
}
Update.dispatchImmediately { // FIXME: reason: nil
update()
}
}
}
}
83 changes: 0 additions & 83 deletions Sources/OpenSwiftUI/View/Toggle/Switch.swift

This file was deleted.

Loading