mirror of
https://github.com/NinjaCheetah/RIT-Dining.git
synced 2026-03-05 05:25:29 -05:00
Replace all instances of "RIT Dining" with "TigerDine"
The project and some files were still named that way, so that's been fixed now. The bundle ID is stuck that way forever but oh well. Nobody will see that.
This commit is contained in:
38
TigerDine/Data/NotifyingChefs.swift
Normal file
38
TigerDine/Data/NotifyingChefs.swift
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// NotifyingChefs.swift
|
||||
// TigerDine
|
||||
//
|
||||
// Created by Campbell on 10/1/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
@Observable
|
||||
class NotifyingChefs {
|
||||
private var notifyingChefs: Set<String>
|
||||
private let key = "NotifyingChefs"
|
||||
|
||||
init() {
|
||||
let chefs = UserDefaults.standard.array(forKey: key) as? [String] ?? [String]()
|
||||
notifyingChefs = Set(chefs)
|
||||
}
|
||||
|
||||
func contains(_ chef: String) -> Bool {
|
||||
notifyingChefs.contains(chef.lowercased())
|
||||
}
|
||||
|
||||
func add(_ chef: String) {
|
||||
notifyingChefs.insert(chef.lowercased())
|
||||
save()
|
||||
}
|
||||
|
||||
func remove(_ chef: String) {
|
||||
notifyingChefs.remove(chef.lowercased())
|
||||
save()
|
||||
}
|
||||
|
||||
func save() {
|
||||
let chefs = Array(notifyingChefs)
|
||||
UserDefaults.standard.set(chefs, forKey: key)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user