QEDModel

public struct QEDModel

QEDModel provides a set of helper methods to aid on persisting a data model ( represented as an array of QEDReport instances and its associated QEDFile instances).

Usage of QEDModel is optional and is meant just as an aid to speed up your data source implementation.

  • Will persist a given array of QEDReport instances to UserDefaults.

    Normally you will call this method when the app goes to background, passing your in memory model array for persisting.

    Note

    This method will also run clean up of local storage files keeping only those belonging to existing reports.

    Declaration

    Swift

    public static func persist(reports: [QEDReport])

    Parameters

    reports

    An array of QEDReport instances representing your data model to be persisted locally to UserDefaults

  • Returns the locally persisted array of QEDReport instances.

    Declaration

    Swift

    public static func loadFromStore() -> [QEDReport]

    Return Value

    Returns the currently persisted array of QEDReport instances from UserDefaults If no array is persisted currently in UserDefaults, an empty array will be returned.