I'm trying to write an application for swift control iTunes. But when initializing the application returns an object of type AnyObject, but must iTunesApplication.
This object does not respond to methods and variables iTunes. Who knows how to make it work?
var iTunes = SBApplication.applicationWithBundleIdentifier("com.apple.iTunes")
The iTunes.h header also holds classes that I need to access but cannot. These classes cause a compilation error as if they are not in a declared a iTunes.h.
Why is this happening to me is not yet clear.
The whole list of classes that are declared a iTunes.h in via @class:
@class iTunesPrintSettings, iTunesApplication, iTunesItem, iTunesAirPlayDevice, iTunesArtwork, iTunesEncoder, iTunesEQPreset, iTunesPlaylist, iTunesAudioCDPlaylist, iTunesLibraryPlaylist, iTunesRadioTunerPlaylist, iTunesSource, iTunesTrack, iTunesAudioCDTrack, iTunesFileTrack, iTunesSharedTrack, iTunesURLTrack, iTunesUserPlaylist, iTunesFolderPlaylist, iTunesVisual, iTunesWindow, iTunesBrowserWindow, iTunesEQWindow, iTunesPlaylistWindow;
For example in Objective - c you would use something like this to get the current track
iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"];
NSLog(@"Current song is %@", [[iTunes currentTrack] name]);
But I cannot get an equivalent in swift to work.