PopupEvents
struct PopupEvents
Struct describing popups. Protects necessary strings as swift datatypes, and parses
Popups.json
to retrieve a properly formatted
PopupEventModel
.
Popups.json
contains references to popups for
PopupEventPlayer
.
The
scenarioPopups
are necessary. The first level key should match the scenario ID, and the second level key
should match the
popupID
found in the
Answers
database.
The
otherPopups
are for convenience. These must be passed directly to an instance of
PopupEventPlayer
.
-
Undocumented
Declaration
Swift
var bundle: Bundle
-
For matching with JSON keys.
Important
This enum needs to be kept in sync with the structure and expected values for StorySequences.json. The values in PowerUp Story Designer web app should have matching values here.Declaration
Swift
enum PopupType : String
-
For matching with JSON keys.
Important
This enum needs to be kept in sync with the structure and expected values for StorySequences.json. The values in PowerUp Story Designer web app should have matching values here.Declaration
Swift
enum PopupCollection : String
-
Parse
Popup.json
, search for the target popup, and return a formattedPopupEvent
.Throws
print(error.localizedDescription)
if unable to retrieve data.Declaration
Swift
func getPopup(type: PopupType, collection: String, popupID: Int) -> PopupEvent?
Parameters
type
The type of the target popup to be retrieved. Should either use the enum
PopupType
or a matching string.collection
The collection of the target popup to be retrieved. Should use a string, either literal or the
rawValue
of aPopupCollection
enum case.popupID
The unique id number for the desired popup.
Return Value
A formatted
PopupEvent
.