I have created a new class in another file in Swift. The second class is a UIViewController that will have mediaPickers in. I want to add this viewController to scene, but I can't figure out how.
I have tried
class mediaViewController: UIViewController, MPMediaPickerControllerDelegate, AVAudioPlayerDelegate
var musicPlayer : MPMusicPlayerController?
var mediaPicker : MPMediaPickerController?
var subViewLoad : UIView?
override func viewDidLoad()
override func viewDidAppear(animated: Bool)
mediaPicker = MPMediaPickerController(mediaTypes: .AnyAudio)
if let picker = mediaPicker
print("Successfully instantiated a media picker")
picker.delegate = self
picker.allowsPickingMultipleItems = true
picker.showsCloudItems = true
picker.prompt = "Pick a song please..."
presentViewController(picker, animated: true, completion: nil)
print("Could not instantiate a media picker")
For anyone else that was interested in the answer to this, what I done was to get the rootViewController and add a UIView to that.
let presentedVC = UIApplication.sharedApplication().keyWindow?.rootViewController