CPEData
iOS native object mapping for MovieLabs Cross-Platform Extras Manifest, Common Metadata, AppData and Style specs, compatible with CPEExperience for a full UI implementation.
Currently supported specs:
- Media Manifest v1.5 conforming to Interactivity Profile 1
- Common Metadata v2.4
- CPE-AppData v1.0
- CPE-Style v1.0
Installation
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapodsTo integrate CPEData into your Xcode project using CocoaPods, specify it in your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target '<Your Target Name>' do
pod 'CPEData', '~> 3.0'
endThen, run the following command:
$ pod installCarthage
Carthage is a decentralized dependency manager for Cocoa applications.
To integrate CPEData into your Xcode project using Carthage, specify it in your Cartfile:
github "warnerbros/cpe-manifest-ios-data" ~> 3.0
Then, add CPEData.framework and SWXMLHash.framework to "Linked Frameworks and Libraries" and Carthage's "copy-frameworks" script
Usage
Use the static load functions in CPEXMLSuite for a convenient way to initialize and parse all the supported spec files.
Providing URL objects
CPEXMLSuite.load(manifestXMLURL: manifestXMLURL, appDataXMLURL: appDataXMLURL, cpeStyleXMLURL: cpeStyleXMLURL) { (error) in
if let error = error {
// Respond to error case
} else {
// Respond to parsing completion event (ExperienceLauncher.launch)
}
}Providing Data objects
CPEXMLSuite.load(manifestXMLData: manifestXMLData, appDataXMLData: appDataXMLData, cpeStyleXMLData: cpeStyleXMLData) { (error) in
if let error = error {
// Respond to error case
} else {
// Respond to parsing completion event (ExperienceLauncher.launch)
}
}Development
Open Example/CPEDataExampleWorkspace.xcworkspace in Xcode to build and run the sample project, which allows you to specify your own XML file URLs to be parsed and mapped to the library's native classes. The example project also provides a UI to explore the hierarchy of the parsed data:
