request Record Permission in AVFoundation

I am trying to implement a request to use a microphone and i've created a function that records the audio based on the audio status which contains cases of playing, stopped, and recording. When I have updated the method for checking if a user has granted access and to record audio after granting in a if else statement, the compiler is giving me an error "Instance member 'record' cannot be used on type 'AudioBox'; did you mean to use a value of this type instead?" below is the code i've made for the class AudioBox, the enum AudioStatus, and the function that i've created to actually check if the permission is granted. if anyone can tell me what i'm doing wrong with example.

@MainActor class AudioBox: NSObject, ObservableObject   {
    
    
    @Published var status = AudioStatus.stopped
    
    var audioRecorder: AVAudioRecorder?
    var audioPlayer: AVPlayer?
    
    // MARK: Saving audio
    
    var urlForVocals: URL {
        let fileManger = FileManager.default
        let tempDirectory = fileManger.temporaryDirectory
        // might need to set this to being a stored dirrectory inisde of the app that saves user's vocals in MP3 format permentally until the app is deleted or when the user deletes the recording/ file
        let filePath = "TempVocalRecording.caf"
        return tempDirectory.appendingPathComponent(filePath)
    }
    
    // MARK: setting up an audio recorder
    func setupRecorder() {
        let recordingSettings: [String: Any] = [
            AVFormatIDKey: Int(kAudioFormatLinearPCM),
            AVSampleRateKey: 44100.0,
            AVNumberOfChannelsKey: 1,
            AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue
       ]
        do {
            audioRecorder = try AVAudioRecorder(url: urlForVocals, settings: recordingSettings)
            audioRecorder?.delegate = self 
         } catch {
            print("There has been an error creating Audio Recorder")
            
        }
    }
    
    // MARK: Recording the audio
    func record(){
        audioRecorder?.record()
        status = .recording
     }
    func stopRecording() {
        audioRecorder?.stop()
        status = .stopped
    }
    
    
    // MARK: Playing the aduio file
    
    @MainActor func playSound() {
        guard let url = Bundle.main.url(forResource: "soundName", withExtension: "mp3") else { return }

        do {
            try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default)
            try AVAudioSession.sharedInstance().setActive(true)
            let player = try AVAudioPlayer(contentsOf: url, fileTypeHint: AVFileType.mp3.rawValue)
                player.play()

        } catch let error {
            print(error.localizedDescription)
        }
    }
}
    
          //MARK: Setting audio delegates

extension AudioBox: AVAudioRecorderDelegate {
    
    func audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder, successfully flag: Bool) {
        status = .stopped
        
    }
    
    
}







    import Foundation
    
    var appHasMicAccess = true
    
    enum AudioStatus: Int, CustomStringConvertible {
    
      case stopped,
           playing,
           recording
    
      var audioName: String {
        let audioNames = ["Audio:Stopped", "Audio:Playing", "Audio:Recording"]
        return audioNames[rawValue]
      }
    
      var description: String {
        return audioName
      }
    
    
    }
    







    class AudioRecorderViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        var audioBox = AudioBox()
           appHasMicAccess = false
    }
    
    
    private func requestMicrophoneAccess() {
        let session = AVAudioSession.sharedInstance()
        session.requestRecordPermission { granted in
            appHasMicAccess = granted
          if granted {
              AudioBox.record()
          } else {
              print("Please Enable Microphone Access in Settings > Privacy > Microphone")
                }
              }
    

}
}