Double

Double is a double-precision 8 byte floating-point type with an approximate range of 2.3E-308 to 1.7E+308.

The default value of a Double is 0.0. You can change the default value of the property by assigning a new value in an overridden reset method.

Local properties

Slider UI

Allows a double property to be changed in Appfigurate using a slider between minimum and maximum values.

Swift prototype

@DoublePropertySlider(min, max, icon, description, restart)
var propertyName: Double

You can customize the minimum and maximum images using the icon parameter. If restart is true, then the app will be restarted if the property value changes.

Swift example

import AppfigurateLibrary

@objcMembers class Configuration: APLConfiguration {

    @DoublePropertySlider(min: 60.5, max: 120.41, icon: .volume, description: "Clipping - decibels", restart: false)
    var maxDecibel: Double
    
    override func reset() {
        maxDecibel = 100.0
    }
    ...

Editable UI

Allows a double property to be changed in Appfigurate using a text field between minimum and maximum values, and an optional regular expression validating input.

Swift prototype

@DoublePropertyEdit(min, max, regex, description, restart)
var propertyName: Double

If restart is true, then the app will be restarted if the property value changes.

Swift example

import AppfigurateLibrary

@objcMembers class Configuration: APLConfiguration {

    @DoublePropertyEdit(min: -2.1, max: 4.1, regex: "", description: "Shot accuracy", restart: false)
    var shotAccuracy: Double
    
    override func reset() {
        shotAccuracy = 3.241
    }
    ...

List UI

Allows a double property to be changed in Appfigurate by allowing the user to select from a predefined list of valid choices.

Swift prototype

@DoublePropertyList(description, restart, values)
var propertyName: Double

If restart is true, then the app will be restarted if the property value changes.

Swift example

import AppfigurateLibrary

@objcMembers class Configuration: APLConfiguration {

    @DoublePropertyList(description: "Quality rating", restart: true, values: ["Low": 10.0, "Average": 50.0, "Excellent": 95.0])
    var rating: Double
    
    override func reset() {
        qualityRating = 10.0
    }
    ...

Editable List UI

Allows a double property to be changed in Appfigurate by allowing the user to select from a predefined list of valid choices. The user can customize the list adding by additional values using a text field between minimum and maximum values, and an optional regular expression validating input.

Swift prototype

@DoublePropertyListEdit(min, max, regex, description, restart, values)
var propertyName: Double

If restart is true, then the app will be restarted if the property value changes.

Swift example

import AppfigurateLibrary

@objcMembers class Configuration: APLConfiguration {

    @DoublePropertyListEdit(min: 0.0, max: 366.0, regex: #"^(0?[0-9]?[0-9]|[1-2][0-9][0-9]|3[0-5][0-9]|36[0-5])?(?:\.\d+)?$"#, description: "Forward server time (days)", restart: false, values: ["7 days": 7.0, "1 month": 30.0, "1 Year": 365.0])
    var forwardServerTime: Double
    
    override func reset() {
        forwardServerTime = 7.0
    }
    ...

Remote properties

Remote Editable UI

Allows a third party remote configuration provider's double property to be changed locally in Appfigurate using a text field. If the override tick box is ticked off, the third party remote configuration provider's value is displayed. If the override tick box is ticked on, then you can use Appfigurate to locally override the value.

Swift prototype

@RemoteDoublePropertyEdit(remoteKey, description, restart)
var propertyName: Double

Swift example

import AppfigurateLibrary

@objcMembers class Configuration: APLConfiguration {

    @RemoteDoublePropertyEdit(remoteKey: "fontSize", description: "Size of font throughout app")
    var fontSize: Double
    
    override func reset() {
        fontSize = 13.0
    }
    ...

Last updated