Shows when app receives memory warning

main
Laurent 3 years ago
parent 845b9a7eac
commit 47be480d37
  1. 1
      LeCountdown/AppDelegate.swift
  2. 2
      LeCountdown/Conductor.swift
  3. 5
      LeCountdown/Views/ContentView.swift

@ -46,6 +46,7 @@ class AppDelegate : NSObject, UIApplicationDelegate {
}
func applicationDidReceiveMemoryWarning(_ application: UIApplication) {
Conductor.maestro.memoryWarningReceived = true
Logger.log("applicationDidReceiveMemoryWarning")
FileLogger.log("applicationDidReceiveMemoryWarning")
}

@ -35,6 +35,8 @@ class Conductor: ObservableObject {
@Published private (set) var liveTimers: [LiveTimer] = []
@Published var memoryWarningReceived: Bool = false
init() {
self.currentCountdowns = Conductor.savedCountdowns
self.currentStopwatches = Conductor.savedStopwatches

@ -83,6 +83,11 @@ struct ContentView<T : AbstractTimer>: View {
// .environment(\.managedObjectContext, viewContext)
// })
.toolbar {
if Conductor.maestro.memoryWarningReceived {
ToolbarItemGroup(placement: .navigationBarTrailing) {
Image(systemName: "circle.fill").font(.caption2).foregroundColor(.orange)
}
}
MainToolbarView(isEditing: self.$isEditing)
}
.onAppear {

Loading…
Cancel
Save