# Boolean

{% tabs %}
{% tab title="Swift" %}
`Bool` properties must be either `true` or `false`. The default value of a `Bool` property is `false`. 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" %}
`BOOL` properties must be either `YES` or `NO`. The default value of a `BOOL` property is `NO`. 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.

`BOOL` 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) BOOL 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.
{% endtab %}
{% endtabs %}

## **Local properties**

### **Switch UI**

Allows a boolean property to be changed in Appfigurate using a switch.&#x20;

<img src="/files/g98YO15rpMwjTNH70LkG" alt="" data-size="original">

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

> Swift prototype

```swift
@BoolProperty(description, restart)
var propertyName: Bool
```

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

> Swift example

```swift
import AppfigurateLibrary

@objcMembers class Configuration: APLConfiguration {
    
    @BoolProperty(description: "Enable debug logging to console", restart: false)
    var logging: Bool
    
    override func reset() {
        logging = true
    }
    ...
```

{% endtab %}

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

> Objective-C prototype

```objectivec
BOOL_PROPERTY(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) BOOL logging;

@end

@implementation Configuration

BOOL_PROPERTY(logging, @"Enable debug logging to console", NO);

- (void) reset {
    self.logging = YES;
}
...
```

{% endtab %}

{% tab title="Dart" %}

> Dart example

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

public class Configuration extends APLNativeConfiguration {

    bool get logging => nativeBool('logging');
    ...
```

{% endtab %}

{% tab title="JavaScript" %}

> JavaScript example

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

const {Appfigurate} = NativeModules;

...

let logging = await Appfigurate.nativeValue("logging"); // true or false
```

{% endtab %}
{% endtabs %}

## Remote properties

### Remote Switch UI

Allows a third party remote configuration provider's boolean property to be changed locally in Appfigurate using a switch. 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.

![](/files/L5YLhZzYZluPdUSNMQJF)

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

> Swift prototype

```swift
@RemoteBoolProperty(remoteKey, description)
var propertyName: Bool
```

> Swift example

```swift
import AppfigurateLibrary

@objcMembers class Configuration: APLConfiguration {
    
    @RemoteBoolProperty(remoteKey: "alwaysDarkMode", description: "Force dark mode to be always set")
    var alwaysDarkMode: Bool
    
    override func reset() {
        alwaysDarkMode = false
    }
    ...
```

{% endtab %}

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

> Objective-C prototype

```objectivec
BOOL_PROPERTY(propertyName, remoteKey, description)
```

> Objective-C example

```objectivec
@import AppfigurateLibrary;

@interface Configuration : APLConfiguration

@property(nonatomic, assign) BOOL alwaysDarkMode;

@end

@implementation Configuration

BOOL_PROPERTY(alwaysDarkMode, @"alwaysDarkMode", @"Force dark mode to be always set");

- (void) reset {
    self.alwaysDarkMode = NO;
}
...
```

{% endtab %}

{% tab title="Dart" %}

> Dart example

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

public class Configuration extends APLNativeConfiguration {

    bool get alwaysDarkMode => nativeBool('alwaysDarkMode');
    ...
```

{% endtab %}

{% tab title="JavaScript" %}

> JavaScript example

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

const {Appfigurate} = NativeModules;

...

let alwaysDarkMode = await Appfigurate.nativeValue("alwaysDarkMode"); // true or false
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.electricbolt.co.nz/configuration-subclasses/supported-property-types/boolean.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
