Integer

Int is platform dependent, 32-bit signed values on 32-bit CPUs (Apple Watch; arm64_32) and 64-bit signed values on 64-bit CPUs (iPhone, iPad; arm64).

The default value of a Int is 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 an integer property to be changed in Appfigurate using a slider between minimum and maximum values.

Swift prototype

@IntPropertySlider(min, max, icon, description, restart)
var propertyName: Int

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 {

    @IntPropertySlider(min: 50, max: 100, icon: .volume, description: "Limit volume level", restart: true)
    var volumeRange: Int
    
    override func reset() {
        volumeRange = 75
    }
    ...

Editable UI

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

Swift prototype

@IntPropertyEdit(min, max, regex, description, restart)
var propertyName: Int

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

Swift example

import AppfigurateLibrary

@objcMembers class Configuration: APLConfiguration {

    @IntPropertyEdit(min: 1, max: 5, regex: "", description: "Maximum number of game levels", restart: false)
    var gameLevels: Int
    
    override func reset() {
        gameLevels = 3
    }
    ...

List UI

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

Swift prototype

@IntPropertyList(description, restart, values)
var propertyName: Int

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

Swift example

import AppfigurateLibrary

@objcMembers class Configuration: APLConfiguration {

    @IntPropertyList(description: "Quality rating", restart: false, values: ["Low": 10, "Average": 50, "Excellent": 95])
    var rating: Int
    
    override func reset() {
        rating = 10
    }
    ...

Editable List UI

Allows an integer 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

@IntPropertyListEdit(min, max, regex, description, restart, values)
var propertyName: Int

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

Swift example

import AppfigurateLibrary

@objcMembers class Configuration: APLConfiguration {

    @IntPropertyListEdit(min: 0, max: 365, regex: "^(0?[0-9]?[0-9]|[1-2][0-9][0-9]|3[0-5][0-9]|36[0-5])$", description: "Duration in days emails are available", restart: false, values: ["7 days": 7, "1 month": 30, "1 Year": 365])
    var availablityDuration: Int
    
    override func reset() {
        volumeRange = 7
    }
    ...

Remote properties

Remote Editable UI

Allows a third party remote configuration provider's integer 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

@RemoteIntPropertyEdit(remoteKey, description)
var propertyName: Int

Swift example

import AppfigurateLibrary

@objcMembers class Configuration: APLConfiguration {
    
    @RemoteIntPropertyEdit(remoteKey: "bookingDuration", description: "Duration (days) for reservation bookings")
    var bookingDuration: Int
    
    override func reset() {
        bookingDuration = 180
    }
    ...

Last updated