# Double

{% tabs %}
{% tab title="Swift" %}
`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 [<mark style="color:blue;">`reset`</mark>](https://www.electricbolt.co.nz/api/Classes/APLConfiguration.html#/c:objc\(cs\)APLConfiguration\(im\)reset) method.
{% endtab %}

{% tab title="Objective-C" %}
`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 [<mark style="color:blue;">`reset`</mark>](https://www.electricbolt.co.nz/api/Classes/APLConfiguration.html#/c:objc\(cs\)APLConfiguration\(im\)reset) method.

`double` properties should be declared in your [<mark style="color:blue;">`APLConfiguration`</mark>](https://www.electricbolt.co.nz/api/Classes/APLConfiguration.html) subclass header file as follows:

```objectivec
@import AppfigurateLibrary;

@interface Configuration : APLConfiguration

@property(nonatomic, assign) double propertyName;
...
```

{% endtab %}

{% tab title="Dart" %}
The flutter [<mark style="color:blue;">`APLNativeConfiguration`</mark>](https://pub.dev/documentation/appfigurateflutter/latest/appfigurateflutter/APLNativeConfiguration-class.html) class defers to the underlying platform [<mark style="color:blue;">`APLConfiguration`</mark>](https://www.electricbolt.co.nz/api/Classes/APLConfiguration.html) (iOS) or [<mark style="color:blue;">`nz.co.electricbolt.appfiguratelibrary.Configuration`</mark>](https://www.electricbolt.co.nz/api/android/nz/co/electricbolt/appfiguratelibrary/Configuration.html) (Android) subclass to read property values.
{% endtab %}

{% tab title="JavaScript" %}
The React Native module `AppfigurateModule` class defers to the underlying platform [<mark style="color:blue;">`APLConfiguration`</mark>](https://www.electricbolt.co.nz/api/Classes/APLConfiguration.html) (iOS) or [<mark style="color:blue;">`nz.co.electricbolt.appfiguratelibrary.Configuration`</mark>](https://www.electricbolt.co.nz/api/android/nz/co/electricbolt/appfiguratelibrary/Configuration.html) (Android) subclass to read property values.

React Native always converts the underlying Double to a JavaScript Number - you should be aware of [JavaScript's 53 bit limitation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER).
{% endtab %}
{% endtabs %}

## **Local properties**

### **Slider UI**

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

![](https://1008176080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw1fcw3dvtSrfUh3YtO9Z%2Fuploads%2FurODxzBpC3LjLCQaHq7B%2FFloatSlider.png?alt=media\&token=c1fd0e23-9c4f-4e91-a494-1934a51bc8d9)

{% tabs %}
{% tab title="Swift" %}

> Swift prototype

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

You can customize the minimum and maximum images using the [<mark style="color:blue;">`icon`</mark>](https://www.electricbolt.co.nz/api/Enums/APLIconSlider.html) parameter. If `restart` is `true`, then the app will be restarted if the property value changes.

> Swift example

```swift
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
    }
    ...
```

{% endtab %}

{% tab title="Objective-C" %}

> Objective-C prototype

<pre class="language-objectivec"><code class="lang-objectivec"><strong>DOUBLE_PROPERTY_SLIDER(propertyName, minValue, maxValue, icon, description, restart)
</strong></code></pre>

You can customize the minimum and maximum images using the [<mark style="color:blue;">`icon`</mark>](https://docs.electricbolt.co.nz/configuration-subclasses/slider-icon-types) parameter. If `restart` is `YES`, then the app will be restarted if the property value changes.

> Objective-C example

```objectivec
@import AppfigurateLibrary;

@interface Configuration : APLConfiguration

@property(nonatomic, assign) double maxDecibel;

@end

@implementation Configuration

DOUBLE_PROPERTY_SLIDER(maxDecibel, 60.5, 120.41, APLIconSliderVolume, @"Clipping - decibels", NO);

- (void) reset {
    self.maxDecibel = 100.0;
}
...
```

{% endtab %}

{% tab title="Dart" %}

> Dart prototype

```dart
double get propertyName => nativeDouble('propertyName');
```

> Dart example

```dart
import 'package:appfigurateflutter/appfigurateflutter.dart';

public class Configuration extends APLNativeConfiguration {

    double get maxDecibel => nativeDouble('maxDecibel');
    ...
```

{% endtab %}

{% tab title="JavaScript" %}

> JavaScript example

```javascript
import {
  NativeModules,
} from 'react-native';

const {Appfigurate} = NativeModules;

...

let maxDecibel = await Appfigurate.nativeValue("maxDecibel"); // Number
```

{% endtab %}
{% endtabs %}

### **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.

![](https://1008176080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw1fcw3dvtSrfUh3YtO9Z%2Fuploads%2FIwKmbPOsysl2Aq5sihxF%2FFloatEdit.png?alt=media\&token=54defe24-b827-40dd-ae59-a4933b356f4a)

{% tabs %}
{% tab title="Swift" %}

> Swift prototype

```swift
@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

```swift
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
    }
    ...
```

{% endtab %}

{% tab title="Objective-C" %}

> Objective-C prototype

```objectivec
DOUBLE_PROPERTY_EDIT(propertyName, minValue, maxValue, regex, description, restart)
```

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

> Objective-C example

```objectivec
@import AppfigurateLibrary;

@interface Configuration : APLConfiguration

@property(nonatomic, assign) double shotAccuracy;

@end

@implementation Configuration

DOUBLE_PROPERTY_EDIT(shotAccuracy, -2.1, 4.1, @"", @"Shot accuracy", NO);

- (void) reset {
    self.shotAccuracy = 3.241;
}
...
```

{% endtab %}

{% tab title="Dart" %}

> Dart prototype

```dart
double get propertyName => nativeDouble('propertyName');
```

> Dart example

```dart
import 'package:appfigurateflutter/appfigurateflutter.dart';

public class Configuration extends APLNativeConfiguration {

    double get shotAccuracy => nativeDouble('shotAccuracy');
    ...
```

{% endtab %}

{% tab title="JavaScript" %}

> JavaScript example

```javascript
import {
  NativeModules,
} from 'react-native';

const {Appfigurate} = NativeModules;

...

let shotAccuracy = await Appfigurate.nativeValue("shotAccuracy"); // Number
```

{% endtab %}
{% endtabs %}

### **List UI**

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

![](https://1008176080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw1fcw3dvtSrfUh3YtO9Z%2Fuploads%2F4aUXvTQvfRaooTxlk0no%2FFloatList.png?alt=media\&token=efc8c61e-052d-4d71-ab9a-caec05aa4ed1)

{% tabs %}
{% tab title="Swift" %}

> Swift prototype

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

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

> Swift example

```swift
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
    }
    ...
```

{% endtab %}

{% tab title="Objective-C" %}

> Objective-C prototype

```objectivec
DOUBLE_PROPERTY_LIST(propertyName, description, restart, ...)
```

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

> Objective-C example

```objectivec
@import AppfigurateLibrary;

@interface Configuration : APLConfiguration

@property(nonatomic, assign) double rating;

@end

@implementation Configuration

DOUBLE_PROPERTY_LIST(rating, @"Quality rating", NO, @{@"Low": @10.0, @"Average": @50.0, @"Excellent": @95.0});

- (void) reset {
    self.rating = 10.0;
}
...
```

{% endtab %}

{% tab title="Dart" %}

> Dart prototype

```dart
double get propertyName => nativeDouble('propertyName');
```

> Dart example

```dart
import 'package:appfigurateflutter/appfigurateflutter.dart';

public class Configuration extends APLNativeConfiguration {

    double get rating => nativeDouble('rating');
    ...
```

{% endtab %}

{% tab title="JavaScript" %}

> JavaScript example

```javascript
import {
  NativeModules,
} from 'react-native';

const {Appfigurate} = NativeModules;

...

let rating = await Appfigurate.nativeValue("rating"); // Number
```

{% endtab %}
{% endtabs %}

### **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.&#x20;

![](https://1008176080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw1fcw3dvtSrfUh3YtO9Z%2Fuploads%2FQ3FpACqUBoSNXjg9GscP%2FFloatListEdit.png?alt=media\&token=10dc9a9f-cda7-4dd6-9293-1d69a291bd39)

{% tabs %}
{% tab title="Swift" %}

> Swift prototype

```swift
@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

```swift
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
    }
    ...
```

{% endtab %}

{% tab title="Objective-C" %}

> Objective-C prototype

```objectivec
DOUBLE_PROPERTY_LIST_EDIT(propertyName, minValue, maxValue, regex, description, restart, ...)
```

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

> Objective-C example

```objectivec
@import AppfigurateLibrary;

@interface Configuration : APLConfiguration

@property(nonatomic, assign) double forwardServerTime;

@end

@implementation Configuration

DOUBLE_PROPERTY_LIST_EDIT(forwardServerTime, 0.0, 366.0, @"^(0?[0-9]?[0-9]|[1-2][0-9][0-9]|3[0-5][0-9]|36[0-5])?(?:\\.\\d+)?$", @"Forward server time (days)", NO, @{@"7 days": @7.0, @"1 month": @30.0, @"1 Year": @365.0});

- (void) reset {
    self.forwardServerTime = 7.0;
}
...
```

{% endtab %}

{% tab title="Dart" %}

> Dart prototype

```dart
double get propertyName => nativeDouble('propertyName');
```

> Dart example

```dart
import 'package:appfigurateflutter/appfigurateflutter.dart';

public class Configuration extends APLNativeConfiguration {

    double get forwardServerTime => nativeDouble('forwardServerTime');
    ...
```

{% endtab %}

{% tab title="JavaScript" %}

> JavaScript example

```javascript
import {
  NativeModules,
} from 'react-native';

const {Appfigurate} = NativeModules;

...

let forwardServerTime = await Appfigurate.nativeValue("forwardServerTime"); // Number
```

{% endtab %}
{% endtabs %}

## 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.

![](https://1008176080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw1fcw3dvtSrfUh3YtO9Z%2Fuploads%2FKPYgrW2ZZdZOq33dXbck%2Fremotefontsize.png?alt=media\&token=b5d76334-447f-44db-a891-12c2d9b8e705)

{% tabs %}
{% tab title="Swift" %}

> Swift prototype

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

> Swift example

```swift
import AppfigurateLibrary

@objcMembers class Configuration: APLConfiguration {

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

{% endtab %}

{% tab title="Objective-C" %}

> Objective-C prototype

<pre class="language-objectivec"><code class="lang-objectivec"><strong>REMOTE_DOUBLE_PROPERTY_EDIT(propertyName, remoteKey, description)
</strong></code></pre>

> Objective-C example

```objectivec
@import AppfigurateLibrary;

@interface Configuration : APLConfiguration

@property(nonatomic, assign) double fontSize;

@end

@implementation Configuration

REMOTE_DOUBLE_PROPERTY_EDIT(fontSize, @"Size of font throughout app");

- (void) reset {
    self.fontSize = 13.0;
}
...
```

{% endtab %}

{% tab title="Dart" %}

> Dart prototype

```dart
double get propertyName => nativeDouble('propertyName');
```

> Dart example

```dart
import 'package:appfigurateflutter/appfigurateflutter.dart';

public class Configuration extends APLNativeConfiguration {

    double get fontSize => nativeDouble('fontSize');
    ...
```

{% endtab %}

{% tab title="JavaScript" %}

> JavaScript example

```javascript
import {
  NativeModules,
} from 'react-native';

const {Appfigurate} = NativeModules;

...

let fontSize = await Appfigurate.nativeValue("fontSize"); // Number
```

{% endtab %}
{% endtabs %}
