This is simple VAST parser with Swift.
VAST is Digital Video Ad Serving Template defined by iAB.
To follow this format, Ad Server and Client can communicate.
Client prepare player based on VAST data.
Please check Unit Test, Unit Test covers iAB samples This is an exmaple code
let vastParser = VastParser(contents: "")
let success = vastParser.parse()
let vastParser = VastParser(contents: Data())
let success = vastParser.parse()
Basically, this VAST Parser follows just XML structure.
Not organized data level.
For more details, please read Unit Test.
It's easy to understand where you want to get
let inLine = vastParser.vast.vastAd?.vastInline // InLine
let creative = vastParser.vast.vastAd?.vastInline?.creatives.creative[0]
Some VAST arrtibute and data name is not accept for Swift, so need to change several.
ex)
id -> xxxxId (mediafileId)
inline -> vastInLine
- Old Version VAST under 4.0
- Extension, CreativeExtension (will support next version)
Unit Test data is iAB VAST Sample
VAST structure ref is from iAB Document
Created final structure and show in author's blog Ref : VAST
Version | Date | Updates |
---|---|---|
0.1 | 2020/07/19 | First version |