Appfigurate™️
HomeDocumentation
  • Introducing Appfigurate™️ 3
  • Getting Started
    • Getting Started
    • Examples
    • Upgrade guide
      • v1.4.0 to v2.2.0
      • v2.1.1 to v2.2.0
      • v2.2.1 to v3.0.0
      • v3.2.1 to v4.0.0
    • iOS native app integration
      • iOS app extension integration
    • watchOS app integration
      • watchOS app extension integration
    • Android native app integration
    • Mobile Flutter integration
      • Flutter iOS
      • Flutter Android
    • React Native integration
      • iOS native module integration
      • Android native module integration
      • JavaScript integration
    • Third party remote configuration providers
      • Firebase Remote Config
      • Launch Darkly
      • Other third party remote configuration providers
  • Configuration subclasses
    • Supported property types
      • Boolean
      • Integer
      • Float
      • Double
      • Plain String
      • Encrypted String
    • Custom executable actions
    • Slider icon types
  • Additional reading
    • Info.plist options
    • AndroidManifest.xml options
    • Displaying overridden configuration
    • Security
      • Best practice
      • Encryption
      • Export compliance
      • App Store compliance
      • PrivacyInfo.xcprivacy
      • Rotating your private key
  • Automation testing
    • iOS native app automation testing
    • Android native automation testing
  • API
    • iOS and watchOS API
    • Android API
    • Mobile Flutter API
    • React Native API
  • Appfigurate User Guide
    • Introduction
    • Main menu
    • Select app
    • Add app
    • Import app
    • Install example apps
    • Settings
      • Passcode Lock
      • Restore
      • Backup
      • Delete all apps and Settings
      • Analytics
    • Edit app
    • Configure app
    • Permissions
  • Appfigurate SE user guide
    • Introduction
    • Manual encryption
      • ENCRYPTED_STRING macro/function
      • ENCRYPTED_STRING_IOS_WATCHOS macro/function
    • Setup iOS Simulator app
    • Setup Android Emulator app
    • Xcode source editor extension
      • Troubleshooting
    • Real device cloud testing services
      • BrowserStack
  • LEGAL
    • License Agreement
    • Privacy Policy
    • Release History
    • Third party notices
Powered by GitBook
On this page
  • Add new app into Appfigurate Simulator
  • Output source code snippets
  • Create APLConfiguration subclass
  • Edit Info.plist
  • Test your iOS app
  1. Getting Started
  2. Mobile Flutter integration

Flutter iOS

PreviousMobile Flutter integrationNextFlutter Android

Last updated 5 months ago

Add new app into Appfigurate Simulator

Run Appfigurate in the iOS Simulator.

Tap ≡ Add app.

Select app type iOS.

Enter a URL scheme that will be used by Appfigurate to launch your app in order to read or apply configuration. The URL scheme must be 4-64 ASCII characters in length and must be unique to your app. e.g. YOUR-APP-URLSCHEME

Tap Add app.

Output source code snippets

In Appfiguate Simulator app, under the SWIFT/IOS LIBRARY INTEGRATION section:

Tap Output implementation then tap Clipboard.

Create APLConfiguration subclass

In Xcode, add a new Swift class, subclassing . e.g. Configuration

In your apps Configuration.swift file, paste the implementation file in the clipboard from the section above.

Note: your public key copied into the clipboard in the section above will be different to the public key in the following example.

Swift Configuration example

import Foundation
import AppfigurateLibrary

@objcMembers class Configuration: APLConfiguration {

    @BoolProperty(description: "Log debug output to console", restart: false)
    var debugLogging: Bool

    @StringPropertyListEdit(regex: #"https://[\w\.-]+\.yourappserver.com/.*"#, description: "Application server url", restart: false, values: ["Dev":"https://dev.yourappserver.com/api", "Prod":"https://www.yourappserver.com/api"])
    var serverURL: String

    override func allowInvalidSignatures() -> Bool {
        return !ENCRYPTED()
    }

    override func publicKey() -> String {
        // 41 36 87 71 0D 05
        return "-----BEGIN PUBLIC KEY-----\n" +
            "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4TZnKfGeXttN7Rr3eiAZ\n" +
            ...
            "ywIDAQAB\n" +
            "-----END PUBLIC KEY-----\n";
    }

    override func reset() {
        debugLogging = true
        serverURL = "https://www.yourappserver.com/api"
    }

}

@_cdecl("APLConfigurationClass")
func APLConfigurationClass() -> AnyClass {
    return Configuration.self
}

Edit Info.plist

Info.plist example

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>appfigurate.YOUR-APP-URLSCHEME</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>YOUR-APP-URLSCHEME</string>
        </array>
    </dict>
</array>

If you already have an existing CFBundleURLTypes array in your Info.plist file, then insert just the <dict> ... </dict> portion.

Test your iOS app

To test that you've successfully updated your app to use Appfigurate:

  • Compile and run your app to the Simulator instance.

  • Launch the Appfigurate Simulator app.

  • Tap your applications row. The app will be run and made visible, it's configuration read, and then swap back to Appfigurate.

The function with C calling convention must be implemented in your app otherwise a linker error will be issued. The recommended place to implement is at the bottom of your subclass.

In your apps Info.plist file (right click, Open As ‣ Source Code) include the following. Replace the text YOUR-APP-URLSCHEME with your own app's URL Scheme - the same value you added in the section above.

Appfigurate's screen will now be displayed. You can now change the debugLogging and serverURL properties. Tap Apply⌄ to apply the configuration to your app.

Now jump to .

APLConfigurationClass
APLConfiguration
Configure app
Flutter Android
APLConfiguration
Output source code snippets
Output source code snippets
Add new app into Appfigurate Simulator