DragonflAICore

public class DragonflAICore : LicenseProviding

DragonflAICore manages central API functions.

It is important that you set the account details before using any DragonflAI classes. E.g.

 func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
     DragonflAI.SDK.setAccount(...)
     return true
 }

The Logging provider for the whole SDK may be set on this class, overriding the default console logger.

  • Provides the current license status of the SDK

    Observe NSNotification.Name.co_dragonflai_statusUpdatedNotification for changes

    Declaration

    Swift

    public static var status: LicenseStatus { get }
  • Set the account details used for licensing checks

    Declaration

    Swift

    public static func useAccount(_ account: Account)
  • Set the logger used for the whole SDK.

    The provided ConsoleLogger struct simply wraps NSLog. Provide a custom implementation of Logging to handle logs, e.g. pass them to your app’s log provider.

    Default: ConsoleLogger with logLevel = .warn

    Declaration

    Swift

    public static func useLogger(_ logger: Logging?)
  • Set the logger used for the whole SDK.

    Deprecated: use useLogger(_ logger: Logging?) instead.

    Declaration

    Swift

    public static func useLogger(logger: Logging?)
  • Set a unique user ID for licensing purposes. Optional.

    This ID will be used for licensing until changed or reset to nil, persisting across restarts of your app.

    If using this option, you may also want to call useLicenseMode(.customerUserID) during initialisation. This will delay licensing checks (and hence use of the SDK) until after the UserID is set, ensuring only identified users are counted for licensing purposes.

    Declaration

    Swift

    public static func useUserID(_ userID: String?)
  • Opt into sending metrics to DragonflAI. Default is false, meaning no metrics are sent.

    Moderation tally sends total counts of image categories seen by the moderator.

    Declaration

    Swift

    public static func sendMetrics(moderationTally: Bool)
  • Set the license checking strategy.

    Declaration

    Swift

    public static func useLicenseMode(_ licenseMode: LicenseMode)
  • SDK semantic version

    Declaration

    Swift

    public static var version: String { get }
  • SDK build number

    Declaration

    Swift

    public static var buildNumber: String { get }