Classes

The following classes are available globally.

  • Holds all of the schema information about a table schema’s columns as read from a backing data store.

    See more

    Declaration

    Swift

    open class ADColumnSchema
  • Creates a label that can be bound to a value from a data model that conforms to the Codable protocol when placed on a ADBoundViewController view. Use the dataPath property to specify the field from the bound data model to populate the label from or supply a formula in a SQL like syntax.

    Example:

    // Given the following class
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    // Bind the label to the name field
    myLabel.dataPath = "name"
    
    See more

    Declaration

    Swift

    @IBDesignable open class ADBoundLabel: UILabel, ADBindable
  • Decodes a Codable or Decodable class from a ADRecord read from a SQLite database using a ADSQLiteProvider. The result is an instance of the class with the properties set from the database record. This decoder will automatically handle URLs and Enums (if the Enum is value based and also marked Codable or Decodable).

    Example:

    import ActionUtilities
    import ActionData
    
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    let encoder = ADSQLEncoder()
    let category = Category()
    let data = try encoder.encode(category)
    
    let decoder = ADSQLDecoder()
    let category2 = try decoder.decode(Category.self, from: data)
    

    Remark

    To retrieve UIColors in the record use the String.uiColor extension property and to retrieve UIImages use the String.uiImage extension property.
    See more

    Declaration

    Swift

    public class ADSQLDecoder: Decoder
  • Creates a slider that can be bound to a value from a data model that conforms to the Codable protocol when placed on a ADBoundViewController view. Use the dataPath property to specify the field from the bound data model to populate the slider’s value from or use a formula in a SQL like syntax.

    Example:

    // Given the following class
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var percentage = 100
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    // Bind the slider to the percentage field
    mySlider.dataPath = "percentage"
    
    See more

    Declaration

    Swift

    @IBDesignable open class ADBoundSlider: UISlider, ADBindable
  • Holds all the information about a table’s schema as read from a backing data store.

    See more

    Declaration

    Swift

    open class ADTableSchema
  • Encodes a Codable or Encodable class into a ADRecord that can be written into a SPON database using a ADSPONiteProvider. The result is a dictionary of key/value pairs representing the data currently stored in the class. This encoder will automatically handle URLs and Enums (if the Enum is value based and also marked Codable or Encodable).

    Example:

    import ActionUtilities
    import ActionData
    
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    let encoder = ADSPONEncoder()
    let category = Category()
    let data = try encoder.encode(category)
    

    Remark

    To store UIColors in the record use the toHex() extension method and to store UIImages use the toData() extension method.
    See more

    Declaration

    Swift

    public class ADSPONEncoder: Encoder
  • Decodes a Codable or Decodable class from a ADRecord read from a SQLite database using a ADSPONiteProvider. The result is an instance of the class with the properties set from the database record. This decoder will automatically handle URLs and Enums (if the Enum is value based and also marked Codable or Decodable).

    Example:

    import ActionUtilities
    import ActionData
    
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    let encoder = ADSPONEncoder()
    let category = Category()
    let data = try encoder.encode(category)
    
    let decoder = ADSPONDecoder()
    let category2 = try decoder.decode(Category.self, from: data)
    

    Remark

    To retrieve UIColors in the record use the String.uiColor extension property and to retrieve UIImages use the String.uiImage extension property.
    See more

    Declaration

    Swift

    public class ADSPONDecoder: Decoder
  • Represents an in-memory Data Store used to provide SQL ability to data sources that typically do not support SQL (such as JSON or XML). ADDataStore works with ADTableStore to define both the structure of the tables and to contain the rows of data stored in each table. ADDataStore understands a subset of the full SQL instruction set (as known by SQLite).

    Use the execute method to execute non-query SQL statements against the Data Store. For example:

    let datastore = ADDataStore()
    
    var sql = """
    CREATE TABLE IF NOT EXISTS parts
    (
        part_id           INTEGER   PRIMARY KEY AUTOINCREMENT,
        stock             INTEGER   DEFAULT 0   NOT NULL,
        name              TEXT,
        description       TEXT      CHECK( description != '' ),    -- empty strings not allowed
        available         BOOL      DEFAULT true
    );
    """
    
    try datastore.execute(sql)
    

    Use the query method to execute query SQL statements and return rows matching the result. For example:

    let results = try datastore.query("SELECT * FROM parts")
    print(results)
    

    Remark

    Since a ADDataStore holds all data in-memory, care should be taken not to overload memory. As a result, an ADDataStore is not a good choice for working with large amounts of data.
    See more

    Declaration

    Swift

    public class ADDataStore
  • A ADMaskedStringFormatter takes a formatting string and applies it as a mask to a given string value. For example, applying format string (###) ###-#### to 8085551212 would result in (808) 555-1212. A ADMaskedStringFormatter can also be used to remove a format from a string, using the example above, given (808) 555-1212 would result in 8085551212.

    Supported Format Characters

    • # - An optional number (0-9). If a number is available at the current character location, the number is emitted, else a space () will be emitted.
    • 0 - A fixed number (0-9). If a number is available at the current character location, the number is emitted, else a zero (0) will be emitted.
    • X - An uppercased letter (A-Z). If a letter is available, it will be converted to upper case and emitted, else a space () is emitted.
    • x - A lowercased letter (a-z). If a letter is available, it will be converted to lower case and emitted, else a space () is emitted.
    • ***** - Any letter (A-Z or a-z). If a letter is available, it will be emitted, else a space () is emitted.
    • _ - Any character. No matter what the character is, it will be emitted as-is.
    • *\* - Escapes the next character and includes it in the formatted output. Use \\ to include a \\, #, 0, X, x, * or _ character in the output.

    Any other character in the format string will be output as-is in the formatted string.

    Example

    // Configure formatter
    let formatter = ADMaskedStringFormatter()
    formatter.formatString = "(###) ###-####"
    
    // Convert output
    let output = formatter.applyFormat(to: "8085551212")
    
    See more

    Declaration

    Swift

    public class ADMaskedStringFormatter
  • Creates a stepper that can be bound to a value from a data model that conforms to the Codable protocol when placed on a ADBoundViewController view. Use the dataPath property to specify the field from the bound data model to populate the stepper’s value from or a formula in a SQL like syntax.

    Example:

    // Given the following class
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var percentage = 100
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    // Bind the stepper to the percentage field
    myStepper.dataPath = "percentage"
    
    See more

    Declaration

    Swift

    @IBDesignable open class ADBoundStepper: UIStepper, ADBindable
  • A ADBoundViewController provides a method to attach it to a data model (any Swift class or structure that conforms to the Codable protocol) and any control conforming to the ADBindable protocol on any View or SubView will automatically be populated with the values from the data model based on the dataPath property of the control. The dataPath must match the name and case of a field on the attached data model or be a formula using a SQL like syntax.

    By using the setDataModel function to set the model and automatically populate the fields, you to not need to create Actions or Outlets for the individual controls. The ADBoundViewController will automatically handle the reading and writing of properties for you.

    For any ADBindable control that is editable, calling the getDataModel function will return the values from the controls on the View and SubViews. These will be written to the field of the data model as specified by the dataPath property of the control, as a result, a formula should not be used for the dataPath of any field that is readable.

    For any field that requires onscreen keyboard support, the ADBoundViewController will automatically handle keyboard events such as moving fields hidden by the keyboard so they are visible and moving them back after they lose focus. Accessory tools can be automatically added to the keyboard to move between the text entry fields and to close the keyboard based on options for each control. These buttons can be customized using the prevButtonText, prevButtonImage, nextButtonText, nextButtonImage, doneButtonText and doneButtonImage properties of the ADBoundViewController.

    The ADBoundTextPicker control has an embedded picker view that will be handled automatically by the ADBoundViewController in a similar fashion as th onscreen keyboard. If the field is covered by the picker, it will be moved automatically to be shown and moved back when the picker is closed. An accessory toolbar will be added to the picker that can be customized with the cancelButtonText, cancelButtonImage, doneButtonText and doneButtonImage properties of the ADBoundViewController.

    Example:

    // Given the following class
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    // Populate any control on the View with values from the data model
    let category = Category(name: "Swift File", description: "A file containing swift source code.")
    do {
       try setDataModel(category)
    } catch {
       print("Failed to set data model")
    }
    
    // Read the vaules back from the controls
    do {
        let category = try getDataModel(Category.self)
        print("Category Description: \(category.description)")
    } catch {
       print("Unable to read data model")
    }
    
    See more

    Declaration

    Swift

    open class ADBoundViewController: UIViewController
  • Defines a set of utilities to handle data related issues such as comparing two values of type Any.

    See more

    Declaration

    Swift

    public class ADUtilities
  • Creates a web view that can be bound to a value from a data model that conforms to the Codable protocol when placed on a ADBoundViewController view. Use the dataPath property to specify the field from the bound data model to use as the URL or the HTML data to display in the web view. Use the containsHTML property to decide if the dataPath contains a URL or HTML data.

    Example:

    // Given the following class
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var icon: Data = UIImage().toData()
        var url = "http://google.com"
    
        required init() {
    
        }
    }
    
    // Bind the web view to the url field
    myWebView.dataPath = "url"
    
    See more

    Declaration

    Swift

    @IBDesignable open class ADBoundWebView: WKWebView, ADBindable
  • Encodes a Codable or Encodable class into a ADRecord that can be written into a SQLite database using a ADSQLiteProvider. The result is a dictionary of key/value pairs representing the data currently stored in the class. This encoder will automatically handle URLs and Enums (if the Enum is value based and also marked Codable or Encodable).

    Example:

    import ActionUtilities
    import ActionData
    
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    let encoder = ADSQLEncoder()
    let category = Category()
    let data = try encoder.encode(category)
    

    Remark

    To store UIColors in the record use the toHex() extension method and to store UIImages use the toData() extension method.
    See more

    Declaration

    Swift

    public class ADSQLEncoder: Encoder
  • Defines a passable dictionary of ADRecord values when encoding or decoding an Action Data class instance. ADInstanceDictionary also introduces support for the new Swift Portable Object Notation (SPON) data format that allows complex data models to be encoded in a portable text string that encodes not only property keys and data, but also includes type information about the encoded data. For example:

    Example:

    let data = "@obj:Rectangle<left!=`0` bottom!=`0` right!=`0` top!=`0`>"
    let dictionary = ADInstanceDictionary.decode(data)
    

    The portable, human-readable string format encodes values with a single character type designator as follows:

    • % - Bool
    • ! - Int
    • $ - String
    • ^ - Float
    • & - Double
    • * - Embedded NSData or Data value

    Additionally, embedded arrays will be in the @array[...] format and embedded dictionaries in the @obj:type<...> format.

    See more

    Declaration

    Swift

    public class ADInstanceDictionary
  • Creates a segmented control that can be bound to a value from a data model that conforms to the Codable protocol when placed on a ADBoundViewController view. Use the dataPath property to specify the field from the bound data model to select the segment from or use a formula in a SQL like syntax. Use the byTitle property to decide if the segment is selected by title or integer position.

    Example:

    // Given the following class
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    // Bind the segemented control to the type field
    mySegment.dataPath = "type"
    
    See more

    Declaration

    Swift

    @IBDesignable open class ADBoundSegmentedControl: UISegmentedControl, ADBindable
  • The ADSPONProvider provides both light-weight, low-level access to data stored in a Swift Portable Object Notation (SPON) database and high-level access via a Object Relationship Management (ORM) model. Use provided functions to read and write data stored in a ADRecord format from and to the database using SQL statements directly.

    Example:

    let provider = ADSPONProvider.shared
    let record = try provider.query("SELECT * FROM Categories WHERE id = ?", withParameters: [1])
    print(record["name"])
    

    Optionally, pass a class instance conforming to the ADDataTable protocol to the ADSPONProvider and it will automatically handle reading, writing and deleting data as required.

    Example:

    let addr1 = Address(addr1: "PO Box 1234", addr2: "", city: "Houston", state: "TX", zip: "77012")
    let addr2 = Address(addr1: "25 Nasa Rd 1", addr2: "Apt #123", city: "Seabrook", state: "TX", zip: "77586")
    
    let p1 = Person(firstName: "John", lastName: "Doe", addresses: ["home":addr1, "work":addr2])
    let p2 = Person(firstName: "Sue", lastName: "Smith", addresses: ["home":addr1, "work":addr2])
    
    let group = Group(name: "Employees", people: [p1, p2])
    try provider.save(group)
    

    Remark

    The ADSPONProvider will automatically create a SQL Table from a class instance if one does not already exist. In addition, ADSPONProvider contains routines to preregister or update the schema classes conforming to the ADDataTable protocol which will build or modify the database tables as required.
    See more

    Declaration

    Swift

    open class ADSPONProvider: ADDataProvider
  • The ADBoundPathProcessor evaluates a given Value Path from a ADBindable control against an ADRecord and returns the result of the valuation. The Value Path can be either the name of a field from the record or a formula in a syntax simular to a SQL SELECT or WHERE clause.

    Example:

    // Given the following class
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    // Bind the label to the name field
    myLabel.dataPath = "'Category: ' + name"
    
    // Get the value of the path
    let value  = ADBoundPathProcessor.evaluate(path: myLabel.dataPath, against: myBoundViewController.record)
    
    See more

    Declaration

    Swift

    public class ADBoundPathProcessor
  • Holds the source table or table group for a SQL SELECT statement. If the type is none this is a single table name and not a join between two (or more) tables.

    See more

    Declaration

    Swift

    public class ADSQLJoinClause
  • Creates a progress view that can be bound to a value from a data model that conforms to the Codable protocol when placed on a ADBoundViewController view. Use the dataPath property to specify the field from the bound data model to populate the progress from or a formula in a SQL like syntax.

    Example:

    // Given the following class
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var percentage = 100
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    // Bind the progress to the percentage field
    myProgress.dataPath = "percentage"
    
    See more

    Declaration

    Swift

    @IBDesignable open class ADBoundProgressView: UIProgressView, ADBindable
  • Creates an image view that can be bound to a value from a data model that conforms to the Codable protocol when placed on a ADBoundViewController view. Use the dataPath property to specify the field from the bound data model to populate the image view from or a formula in a SQL like syntax.

    Example:

    // Given the following class
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    // Bind the image view to the icon field
    myImage.dataPath = "icon"
    
    See more

    Declaration

    Swift

    @IBDesignable open class ADBoundImageView: UIImageView, ADBindable
  • Defines a passable array of values used as temporary storage when encoding or decoding an Action Data class. ADInstanceArray also introduces support for the new Swift Portable Object Notation (SPON) data format that allows complex data models to be encoded in a portable text string that encodes not only property keys and data, but also includes type information about the encoded data. For example:

    Example:

    let data = "@array[1!, 2!, 3!, 4!]"
    let array = ADInstanceArray.decode(data)
    

    The portable, human-readable string format encodes values with a single character type designator as follows:

    • % - Bool
    • ! - Int
    • $ - String
    • ^ - Float
    • & - Double
    • * - Embedded NSData or Data value

    Additionally, embedded arrays will be in the @array[...] format and embedded dictionaries in the @obj:type<...> format.

    See more

    Declaration

    Swift

    public class ADInstanceArray
  • Creates a text field that can be bound to a value from a data model that conforms to the Codable protocol when placed on a ADBoundViewController view. Use the dataPath property to specify the field from the bound data model to populate the text field from or use a formula in a SQL like syntax.

    Example:

    // Given the following class
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    // Bind the label to the name field
    myTextField.dataPath = "name"
    
    See more

    Declaration

    Swift

    open class ADBoundTextField: UITextField, UITextFieldDelegate, ADBindable
  • Creates a text view that can be bound to a value from a data model that conforms to the Codable protocol when placed on a ADBoundViewController view. Use the dataPath property to specify the field from the bound data model to populate the text view from or a formula in a SQL like syntax.

    Example:

    // Given the following class
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    // Bind the text view to the description field
    myTextView.dataPath = "description"
    
    See more

    Declaration

    Swift

    open class ADBoundTextView: UITextView, UITextViewDelegate, ADBindable
  • The Appracatappra License Manager handles verfiying your licensed version of a Appracatappra developer product purchased from our online store. You will need to provide the customer information used to purchase the product, the product license that was sent to you in your purchase receipt and a product activation key. You can generate the activation key at the Activate License page of the Appracatappra, LLC. website. You have a limited number of product activations so please make a copy of your Activation Key and keep it in a safe place.

    Typically, you will provide this information to the AppracatappraLicenseManager when the app first starts in the main method of the Main.cs file.

    Failure to include the requested information will result in a Toast style popup being displayed that reads, Unlicensed Appracatappra Product whenever an Action Component is used.

    See more

    Declaration

    Swift

    public class AppracatappraLicenseManager
  • Defines a binary operation being performed on two expressions in a SQL instruction such as adding two values or comparing two values to see if they are equal.

    See more

    Declaration

    Swift

    public class ADSQLBinaryExpression: ADSQLExpression
  • The ADSQLiteProvider provides both light-weight, low-level access to data stored in a SQLite database and high-level access via a Object Relationship Management (ORM) model. Use provided functions to read and write data stored in a ADRecord format from and to the database using SQL statements directly.

    Example:

    let provider = ADSQLiteProvider.shared
    let record = try provider.query("SELECT * FROM Categories WHERE id = ?", withParameters: [1])
    print(record["name"])
    

    Optionally, pass a class instance conforming to the ADDataTable protocol to the ADSQLiteProvider and it will automatically handle reading, writing and deleting data as required.

    Example:

    let addr1 = Address(addr1: "PO Box 1234", addr2: "", city: "Houston", state: "TX", zip: "77012")
    let addr2 = Address(addr1: "25 Nasa Rd 1", addr2: "Apt #123", city: "Seabrook", state: "TX", zip: "77586")
    
    let p1 = Person(firstName: "John", lastName: "Doe", addresses: ["home":addr1, "work":addr2])
    let p2 = Person(firstName: "Sue", lastName: "Smith", addresses: ["home":addr1, "work":addr2])
    
    let group = Group(name: "Employees", people: [p1, p2])
    try provider.save(group)
    

    Remark

    The ADSQLiteProvider will automatically create a SQL Table from a class instance if one does not already exist. In addition, ADSQLiteProvider contains routines to preregister or update the schema classes conforming to the ADDataTable protocol which will build or modify the database tables as required.
    See more

    Declaration

    Swift

    open class ADSQLiteProvider: ADDataProvider
  • Parses a SQL statement into an Action Data SQL Document Object Model (DOM). This parser currently supports a subset of SQL commands as defined by SQLite. for example:

    let sql = """
    CREATE TABLE IF NOT EXISTS parts
    (
        part_id           INTEGER   PRIMARY KEY,
        stock             INTEGER   DEFAULT 0   NOT NULL,
        description       TEXT      CHECK( description != '' )    -- empty strings not allowed
    );
    """
    
    let instructions = try ADSQLParser.parse(sql)
    print(instructions)
    
    See more

    Declaration

    Swift

    public class ADSQLParser
  • Creates a switch that can be bound to a value from a data model that conforms to the Codable protocol when placed on a ADBoundViewController view. Use the dataPath property to specify the field from the bound data model to populate the switch from or a formula in a SQL like syntax.

    Example:

    // Given the following class
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    // Bind the switch to the enabled field
    mySwitch.dataPath = "enabled"
    
    See more

    Declaration

    Swift

    @IBDesignable open class ADBoundSwitch: UISwitch, ADBindable
  • Creates a text field that can be bound to a value from a data model that conforms to the Codable protocol when placed on a ADBoundViewController view. Use the dataPath property to specify the field from the bound data model to populate the text field from or use a formula in a SQL like syntax. Includes a builtin picker control used to select the value from a list of available values.

    Example:

    // Given the following class
    class Category: ADDataTable {
    
        enum CategoryType: String, Codable {
            case local
            case web
        }
    
        static var tableName = "Categories"
        static var primaryKey = "id"
        static var primaryKeyType: ADDataTableKeyType = .computedInt
    
        var id = 0
        var added = Date()
        var name = ""
        var description = ""
        var enabled = true
        var highlightColor = UIColor.white.toHex()
        var type: CategoryType = .local
        var icon: Data = UIImage().toData()
    
        required init() {
    
        }
    }
    
    // Bind the label to the name field
    myTextField.dataPath = "name"
    
    See more

    Declaration

    Swift

    open class ADBoundTextPicker: UITextField, UITextFieldDelegate, UIPickerViewDelegate, UIPickerViewDataSource, ADBindable
  • Represents an in-memory SQL Data Store table used to hold both the table’s schema and the data it represents.

    Remark

    Since a ADTableStore holds all data in-memory, care should be taken not to overload memory. As a result, an ADTableStore is not a good choice for working with large amounts of data.
    See more

    Declaration

    Swift

    public class ADTableStore