DJ110 / VastParserSwift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VAST Parser for Swift (VAST 4.1)

Swift Version

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.

How to use

Please check Unit Test, Unit Test covers iAB samples This is an exmaple code

Use string

let vastParser = VastParser(contents: "")
let success = vastParser.parse()

Use data

let vastParser = VastParser(contents: Data())
let success = vastParser.parse()

Get VAST data

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]

Name Chage

Some VAST arrtibute and data name is not accept for Swift, so need to change several.

ex)
id -> xxxxId (mediafileId) inline -> vastInLine

Not Support

  • Old Version VAST under 4.0
  • Extension, CreativeExtension (will support next version)

About Unit Test

Unit Test data is iAB VAST Sample

VAST XML structure

VAST structure ref is from iAB Document

Created final structure and show in author's blog Ref : VAST

Version

Version Date Updates
0.1 2020/07/19 First version

About

License:MIT License


Languages

Language:Swift 99.8%Language:Objective-C 0.2%