func getString()

in swift-source/all/Nimbus/FeatureVariables.swift [34:142]


    func getString(_ key: String) -> String?

    /// Find an array for this key, and returns all the strings in that array. If none exists, `nil`
    /// is returned.
    func getStringList(_ key: String) -> [String]?

    /// Find a map for this key, and returns a map containing all the entries that have strings
    /// as their values. If none exists, then `nil` is returned.
    func getStringMap(_ key: String) -> [String: String]?

    /// Returns the whole variables object as a string map
    /// will return `nil` if it cannot be converted
    ///  - Note: This function will omit any variables that could not be converted to strings
    ///  - Returns: a `[String:String]` dictionary representing the whole variables object
    func asStringMap() -> [String: String]?

    /// Finds a integer typed value for this key. If none exists, `nil` is returned.
    ///
    /// N.B. the `key` and type `Int` should be listed in the experiment manifest.
    func getInt(_ key: String) -> Int?

    /// Find an array for this key, and returns all the integers in that array. If none exists, `nil`
    /// is returned.
    func getIntList(_ key: String) -> [Int]?

    /// Find a map for this key, and returns a map containing all the entries that have integers
    /// as their values. If none exists, then `nil` is returned.
    func getIntMap(_ key: String) -> [String: Int]?

    /// Returns the whole variables object as an Int map
    /// will return `nil` if it cannot be converted
    ///  - Note: This function will omit any variables that could not be converted to Ints
    ///  - Returns: a `[String:Int]` dictionary representing the whole variables object
    func asIntMap() -> [String: Int]?

    /// Finds a boolean typed value for this key. If none exists, `nil` is returned.
    ///
    /// N.B. the `key` and type `String` should be listed in the experiment manifest.
    func getBool(_ key: String) -> Bool?

    /// Find an array for this key, and returns all the booleans in that array. If none exists, `nil`
    /// is returned.
    func getBoolList(_ key: String) -> [Bool]?

    /// Find a map for this key, and returns a map containing all the entries that have booleans
    /// as their values. If none exists, then `nil` is returned.
    func getBoolMap(_ key: String) -> [String: Bool]?

    /// Returns the whole variables object as a boolean map
    /// will return `nil` if it cannot be converted
    ///  - Note: This function will omit any variables that could not be converted to booleans
    ///  - Returns: a `[String:Bool]` dictionary representing the whole variables object
    func asBoolMap() -> [String: Bool]?

    /// Uses `getString(key: String)` to find the name of a drawable resource. If no value for `key`
    /// exists, or no resource named with that value exists, then `nil` is returned.
    ///
    /// N.B. the `key` and type `Image` should be listed in the experiment manifest. The
    /// names of the drawable resources should also be listed.
    func getImage(_ key: String) -> UIImage?

    /// Uses `getStringList(key: String)` to get a list of strings, then coerces the
    /// strings in the list into Images. Values that cannot be coerced are omitted.
    func getImageList(_ key: String) -> [UIImage]?

    /// Uses `getStringList(key: String)` to get a list of strings, then coerces the
    /// values into Images. Values that cannot be coerced are omitted.
    func getImageMap(_ key: String) -> [String: UIImage]?

    /// Uses `getString(key: String)` to find the name of a string resource. If a value exists, and
    /// a string resource exists with that name, then returns the string from the resource. If no
    /// such resource exists, then return the string value as the text.
    ///
    /// For strings, this is almost always the right choice.
    ///
    /// N.B. the `key` and type `LocalizedString` should be listed in the experiment manifest. The
    /// names of the string resources should also be listed.
    func getText(_ key: String) -> String?

    /// Uses `getStringList(key: String)` to get a list of strings, then coerces the
    /// strings in the list into localized text strings.
    func getTextList(_ key: String) -> [String]?

    /// Uses `getStringMap(key: String)` to get a map of strings, then coerces the
    /// string values into localized text strings.
    func getTextMap(_ key: String) -> [String: String]?

    /// Gets a nested `JSONObject` value for this key, and creates a new `Variables` object. If
    /// the value at the key is not a JSONObject, then return `nil`.
    func getVariables(_ key: String) -> Variables?

    /// Gets a list value for this key, and transforms all `JSONObject`s in the list into `Variables`.
    /// If the value isn't a list, then returns `nil`. Items in the list that are not `JSONObject`s
    /// are omitted from the final list.
    func getVariablesList(_ key: String) -> [Variables]?

    /// Gets a map value for this key, and transforms all `JSONObject`s that are values into `Variables`.
    /// If the value isn't a `JSONObject`, then returns `nil`. Values in the map that are not `JSONObject`s
    /// are omitted from the final map.
    func getVariablesMap(_ key: String) -> [String: Variables]?

    /// Returns the whole variables object as a variables map
    /// will return `nil` if it cannot be converted
    ///  - Note: This function will omit any variables that could not be converted to a class representing variables
    ///  - Returns: a `[String:Variables]` dictionary representing the whole variables object
    func asVariablesMap() -> [String: Variables]?
}

public extension Variables {