Post

Replies

Boosts

Views

Activity

Comment on Using `@ObservedObject` in a function
While I wait for you to wake up; how would this affect the situation? class GlobalData: ObservableObject { @Published var currentCourse: Course @Published var nextCourse: Course init() { self.currentCourse = getCurrentClass(date: .now)[0] self.nextCourse = getCurrentClass(date: .now)[1] } func reload() -> Void { self.currentCourse = getCurrentClass(date: .now)[0] self.nextCourse = getCurrentClass(date: .now)[1] } }
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’25
Comment on Using `@ObservedObject` in a function
Okay. Will this do it? class GlobalData: ObservableObject { init() { self.currentCourse = getCurrentClass(date: .now)[0] self.nextCourse = getCurrentClass(date: .now)[1] } @Published var currentCourse: Course // the current timetabled class in session. @Published var nextCourse: Course // the next timetabled class in session }
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’25