I'm trying to write an app that will load MIDI files. I've written a Swfit script that works perfectly, but I'm having trouble with putting that into an app.
override func read(from data: Data, ofType typeName: String) throws {
let theMIDIPlayer = try AVMIDIPlayer.init(data: data, soundBankURL: nil)
throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)
}
I'm getting a yellow warning that theMIDIPlayer was never initialized. Xcode made me put in the 'try': is that the reason? As a result, I can't use this in the ViewController, as it claims there's no such member of Document.
override func viewDidAppear() {
let document = self.view.window?.windowController?.document as! Document
self.theView = document.theMIDIPlayer
}
Thanks.