Skip to content

Commit

Permalink
we should use @ObservedObject
Browse files Browse the repository at this point in the history
Signed-off-by: 82Flex <82flex@gmail.com>
  • Loading branch information
Lessica committed Jan 15, 2024
1 parent 1f39955 commit 1cb18fd
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Reveil/Pages/DashboardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ struct DashboardView: View, GlobalTimerObserver {
let id = UUID()
let globalName: String = String(describing: Dashboard.self)

@StateObject private var viewModel = Dashboard.shared
@StateObject private var securityModel = Security.shared
@ObservedObject private var viewModel = Dashboard.shared
@ObservedObject private var securityModel = Security.shared
@State private var isNavigationLinkActive = false

var body: some View {
Expand Down
2 changes: 1 addition & 1 deletion Reveil/Pages/SecurityView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import SwiftUI

struct SecurityView: View {
@StateObject private var securityModel = Security.shared
@ObservedObject private var securityModel = Security.shared

@Environment(\.dismiss) private var dismissAction

Expand Down
2 changes: 1 addition & 1 deletion Reveil/Views/Dashboard/ActivityWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import SwiftUI

struct ActivityWidget: View {
@StateObject var entry: ActivityEntry
@ObservedObject var entry: ActivityEntry

private let columnWidth: CGFloat = 2
private let minColumnSpacing: CGFloat = 3
Expand Down
2 changes: 1 addition & 1 deletion Reveil/Views/Dashboard/CheckmarkWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ColorfulX
import SwiftUI

struct CheckmarkWidget: View {
@StateObject var securityModel: Security = .shared
@ObservedObject var securityModel: Security = .shared
@State var openDetail: Bool = false

var isAnimatedBackgroundEnabled: Bool {
Expand Down
2 changes: 1 addition & 1 deletion Reveil/Views/Dashboard/FieldWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import SwiftUI

struct FieldWidget: View {
@StateObject var entry: BasicEntry
@ObservedObject var entry: BasicEntry

var body: some View {
VStack(spacing: 8) {
Expand Down
4 changes: 2 additions & 2 deletions Reveil/Views/Dashboard/TrafficWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ struct TrafficWidget: View {
let label: String
let style: Style

@StateObject var receivedEntry: TrafficEntry<Int64>
@StateObject var sentEntry: TrafficEntry<Int64>
@ObservedObject var receivedEntry: TrafficEntry<Int64>
@ObservedObject var sentEntry: TrafficEntry<Int64>

private let columnWidth: CGFloat = 2
private let minColumnSpacing: CGFloat = 3
Expand Down
2 changes: 1 addition & 1 deletion Reveil/Views/Dashboard/UsageWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import SwiftUI

struct UsageWidget: View {
@StateObject var entry: UsageEntry<Double>
@ObservedObject var entry: UsageEntry<Double>

private let rowHeight: CGFloat = 18

Expand Down
2 changes: 1 addition & 1 deletion Reveil/Views/Details/FieldCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private struct FieldCell_Internal: View {
}

struct FieldCell: View {
@StateObject var entry: BasicEntry
@ObservedObject var entry: BasicEntry
let delegate: FieldCellDelegate?

var body: some View {
Expand Down
2 changes: 1 addition & 1 deletion Reveil/Views/Details/TrafficCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import SwiftUI

struct TrafficCell: View {
@StateObject var entry: TrafficEntry<Int64>
@ObservedObject var entry: TrafficEntry<Int64>

private let columnWidth: CGFloat = 2
private let minColumnSpacing: CGFloat = 3
Expand Down
2 changes: 1 addition & 1 deletion Reveil/Views/Details/UsageCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct UsageCell: View {
}
}

@StateObject var entry: UsageEntry<Double>
@ObservedObject var entry: UsageEntry<Double>
var style: Style = .regular

private let minimumDisplayableRatio: Double = 0.001
Expand Down

0 comments on commit 1cb18fd

Please sign in to comment.