   
   func loadBirthdays() -> [Birthday] {
     do {
-      let data = try Data(contentsOf: FileManager.default.birthdaysURL())
+      let data = try Data(contentsOf: fileURL)
       return try JSONDecoder().decode([Birthday].self, from: data)
     } catch {
       return []

  }
  
  public func remove(at index: Int) {
    if index < birthdayCounts.count {
      let birthday = birthdayCounts[index].birthday
      if let allIndex = all.firstIndex(of: birthday) {
        all.remove(at: allIndex)
      }

import Foundation

public class BirthdaysManager : ObservableObject {
  
  let fileURL: URL
  public var all: [Birthday] {
    didSet {
      birthdayCountdowns = all
        .map { BirthdayCountdown(birthday: $0) }
        .sorted(by: { $0.remainingDays < $1.remainingDays })
    }
  }
  @Published public private(set) var birthdayCountdowns: [BirthdayCountdown]
  
  public init(fileURL: URL? = nil) {
    if let fileURL = fileURL {
      self.fileURL = fileURL
    } else {
      self.fileURL = FileManager.default.birthdaysURL()
    }
    all = []
    birthdayCountdowns = []
    
    all = loadBirthdays()
    
    birthdayCountdowns = all
      .map { BirthdayCountdown(birthday: $0) }
      .sorted(by: { $0.remainingDays < $1.remainingDays })
  }
