Skip to content

Commit

Permalink
Observation example in demo
Browse files Browse the repository at this point in the history
  • Loading branch information
hmlongco committed Oct 29, 2023
1 parent e967288 commit 706fc75
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions FactoryDemo/FactoryDemo/ObservableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import Observation
#endif
import SwiftUI

@available(iOS 17, *)
protocol ObservationServiceType: AnyObject {
var name: String { get set }
}
Expand Down Expand Up @@ -54,7 +53,7 @@ struct ObservableView: View {

// With traditional inline register
@available(iOS 17, *)
#Preview {
#Preview("Register") {
let _ = Container.shared.observableService.register {
MockObservationService(name: "MockObservationService1")
}
Expand Down Expand Up @@ -87,17 +86,6 @@ struct ObservableView2: View {

// With onPreview
@available(iOS 17, *)
#Preview {
#Preview("onPreview") {
ObservableView2().padding()
}

// With onPreview
@available(iOS 17, *)
#Preview {
Group {
let _ = Container.shared.observableService.register {
MockObservationService(name: "MockObservationService3")
}
ObservableView().padding()
}
}

0 comments on commit 706fc75

Please sign in to comment.