Change to initialize Refresh when the onAppear event happens so that we quit crashing on macOS
This commit is contained in:
parent
aca4cdf4ec
commit
bcbb38c120
|
@ -29,6 +29,9 @@ struct MainApp: App {
|
|||
.frame(minWidth: 600, idealWidth: 1000, maxWidth: .infinity, minHeight: 600, idealHeight: 700, maxHeight: .infinity)
|
||||
.environmentObject(sceneModel)
|
||||
.environmentObject(defaults)
|
||||
.onAppear {
|
||||
sceneModel.startup()
|
||||
}
|
||||
.sheet(isPresented: $showSheet, onDismiss: { showSheet = false }) {
|
||||
AddWebFeedView()
|
||||
}
|
||||
|
@ -155,6 +158,9 @@ struct MainApp: App {
|
|||
.environmentObject(sceneModel)
|
||||
.environmentObject(defaults)
|
||||
.modifier(PreferredColorSchemeModifier(preferredColorScheme: defaults.userInterfaceColorPalette))
|
||||
.onAppear {
|
||||
sceneModel.startup()
|
||||
}
|
||||
}
|
||||
.commands {
|
||||
CommandGroup(after: .newItem, addition: {
|
||||
|
|
|
@ -17,13 +17,12 @@ final class SceneModel: ObservableObject {
|
|||
var timelineModel: TimelineModel?
|
||||
var articleModel: ArticleModel?
|
||||
|
||||
private let refreshProgressModel: RefreshProgressModel
|
||||
private var refreshProgressModel: RefreshProgressModel? = nil
|
||||
|
||||
init(refreshProgressModel: RefreshProgressModel = RefreshProgressModel()) {
|
||||
self.refreshProgressModel = refreshProgressModel
|
||||
self.refreshProgressModel.$state.assign(to: self.$refreshProgressState)
|
||||
func startup() {
|
||||
self.refreshProgressModel = RefreshProgressModel()
|
||||
self.refreshProgressModel!.$state.assign(to: self.$refreshProgressState)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: SidebarModelDelegate
|
||||
|
|
Loading…
Reference in New Issue