The iOS build shares Cog's sources. CogAudio and the projects under
Frameworks/ build for macOS and iOS alike. The plugins, which macOS loads
as bundles, are compiled on iOS into one framework, CogPlugins.
git submodule update --init --recursive
iOS/prepare.shprepare.sh builds the iOS third-party libraries into ThirdParty/*/ios/,
which are not committed, by running Scripts/build-ios-libraries.sh (a few
minutes, needs brew install cmake ninja). CI builds them too: the
ios-libraries artifact of the "Check if Cog builds for iOS" workflow
unpacks into place.
MobileCog.xcodeproj: the iOS app (Cogscheme, sources inApp/), the plugins as one framework (CogPlugins), andCogPluginsTests.- The project is generated by
generate_plugins_project.py. To add or change a plugin, editPLUGINSthere and run the script again; don't edit the project in Xcode. Files added underApp/are picked up as they are. PluginControllerfinds the plugin classes at launch among those of the loaded images.
- The project is generated by
App/: the SwiftUI app: the playlist, Now Playing and settings, withPlayerdriving CogAudio'sAudioPlayerasPlaybackControllerdoes on macOS. Music picked in Files is copied into the app'sDocuments/Music, which Files and Finder show.Localizable.xcstringsholds the app's strings in English and Spanish, which follows the macOS app's wording. The keys the macOS sources ask for withNSLocalizedStringare kept by hand, because the Swift compiler does not extract them.EqualizerPresets.xcstringstranslates the names ofCog.q1.json's presets.
generate_document_types.py: declares the files the app opens inCogApp-Info.plist, from the macOS app's document types inInfo.plist.template. iOS goes by type rather than by extension, so each extension gets the system's type for it or one imported for Cog. Run it again after changing the macOS app's document types. A file opened in Cog is added to the playlist and played; one shared from another app is moved intoDocuments/Music.genversion.sh: versions the app asScripts/genversion.shversions the macOS one, counting commits, but from the iOS app's first commit (700560d4f, version 1) rather than thek54tag. A shallow clone has no history to count and builds version 0.CogPlugins/: the plugins framework's prefix header and build settings.CogPluginsTests/: tests that find, decode and play through the plugins on the iOS Simulator.
CogPlaylist/ is the playlist without AppKit, a framework that builds for
macOS and iOS. It contains:
PlaylistStore: Cog's Core Data stack, on the sharedDataModel.xcdatamodeld.PlaylistEntryextensions: tags, URL andsetMetadata, ported fromPlaylist/PlaylistEntry.m.PlaylistModel: order, current entry, queue, shuffle, repeat and stop-after, ported fromPlaylist/PlaylistController.m.PlaylistLoader: folders and containers through the plugins, and metadata loaded in the background.
Its rules are ported from the macOS app, so keep the two in step. The tests
run on both platforms (CogPlaylist scheme). The loader is tested with the
real plugins in CogPluginsTests.
For now only iOS uses it. For the macOS app to adopt it:
- Its
PlaylistControllerdelegates toPlaylistModel. - It stops generating the model's classes itself, since the entity classes would otherwise exist twice.
- It drops its own copy of
MaybeSecureValueDataTransformer.
- A project under
Frameworks/:Scripts/make-multiplatform.pymakes its targets build for iOS too.Scripts/link-ios-libraries.pylinks the iOS builds of theThirdParty/libraries it uses, leaving the macOS ones to macOS.
- A library in
ThirdParty/: add abuild_<name>function toScripts/build-ios-libraries.sh, with the release and patches itsREADME.mdnames. - After changing plugin sources, check that the macOS app still builds.
- No exclusive output or DoP. Everything is resampled to the audio session's rate.
- 2SF (vio2sf) runs without its JIT, as iOS allows no executable memory.
- MIDI's Apple synth is MIDISynth, as iOS has no DLSSynth. Its SoundFonts are the app's resources, as on macOS.