ParseConfiguration

public struct ParseConfiguration

The Configuration for a Parse client.

  • The application id of your Parse application.

    Declaration

    Swift

    public internal(set) var applicationId: String { get }
  • The master key of your Parse application.

    Declaration

    Swift

    public internal(set) var masterKey: String? { get }
  • The client key of your Parse application.

    Declaration

    Swift

    public internal(set) var clientKey: String? { get }
  • The server URL to connect to Parse Server.

    Declaration

    Swift

    public internal(set) var serverURL: URL { get }
  • The live query server URL to connect to Parse Server.

    Declaration

    Swift

    public internal(set) var liveQuerysServerURL: URL? { get }
  • Allows objectIds to be created on the client.

    Declaration

    Swift

    public internal(set) var isAllowingCustomObjectIds: Bool { get }
  • Use transactions when saving/updating multiple objects.

    Warning

    This is experimental.

    Declaration

    Swift

    public internal(set) var isUsingTransactions: Bool { get }
  • Use the $eq query constraint when querying.

    Warning

    This is known not to work for LiveQuery on Parse Servers <= 5.0.0.

    Declaration

    Swift

    public internal(set) var isUsingEqualQueryConstraint: Bool { get }
  • The default caching policy for all http requests that determines when to return a response from the cache. Defaults to useProtocolCachePolicy. See Apple’s documentation for more info.

    Declaration

    Swift

    public internal(set) var requestCachePolicy: URLRequest.CachePolicy { get }
  • A dictionary of additional headers to send with requests. See Apple’s documentation for more info.

    Declaration

    Swift

    public internal(set) var httpAdditionalHeaders: [AnyHashable : Any]? { get }
  • The memory capacity of the cache, in bytes. Defaults to 512KB.

    Declaration

    Swift

    public internal(set) var cacheMemoryCapacity: Int { get }
  • The disk capacity of the cache, in bytes. Defaults to 10MB.

    Declaration

    Swift

    public internal(set) var cacheDiskCapacity: Int { get }
  • If your app previously used the iOS Objective-C SDK, setting this value to true will attempt to migrate relevant data stored in the Keychain to ParseSwift. Defaults to false.

    Declaration

    Swift

    public internal(set) var isMigratingFromObjcSDK: Bool { get }
  • Deletes the Parse Keychain when the app is running for the first time. Defaults to false.

    Declaration

    Swift

    public internal(set) var isDeletingKeychainIfNeeded: Bool { get }
  • Maximum number of times to try to connect to Parse Server. Defaults to 5.

    Declaration

    Swift

    public internal(set) var maxConnectionAttempts: Int { get }
  • Create a Parse Swift configuration.

    Warning

    usingTransactions is experimental.

    Declaration

    Swift

    public init(applicationId: String,
                clientKey: String? = nil,
                masterKey: String? = nil,
                serverURL: URL,
                liveQueryServerURL: URL? = nil,
                allowCustomObjectId: Bool = false,
                allowingCustomObjectIds: Bool = false,
                usingTransactions: Bool = false,
                usingEqualQueryConstraint: Bool = false,
                keyValueStore: ParseKeyValueStore? = nil,
                requestCachePolicy: URLRequest.CachePolicy = .useProtocolCachePolicy,
                cacheMemoryCapacity: Int = 512_000,
                cacheDiskCapacity: Int = 10_000_000,
                migratingFromObjcSDK: Bool = false,
                deletingKeychainIfNeeded: Bool = false,
                httpAdditionalHeaders: [AnyHashable: Any]? = nil,
                maxConnectionAttempts: Int = 5,
                authentication: ((URLAuthenticationChallenge,
                                  (URLSession.AuthChallengeDisposition,
                                   URLCredential?) -> Void) -> Void)? = nil)

    Parameters

    applicationId

    The application id of your Parse application.

    clientKey

    The client key of your Parse application.

    masterKey

    The master key of your Parse application.

    serverURL

    The server URL to connect to Parse Server.

    liveQueryServerURL

    The live query server URL to connect to Parse Server.

    allowingCustomObjectIds

    Allows objectIds to be created on the client. side for each object. Must be enabled on the server to work.

    usingTransactions

    Use transactions when saving/updating multiple objects.

    usingEqualQueryConstraint

    Use the $eq query constraint when querying.

    keyValueStore

    A key/value store that conforms to the ParseKeyValueStore protocol. Defaults to nil in which one will be created an memory, but never persisted. For Linux, this this is the only store available since there is no Keychain. Linux users should replace this store with an encrypted one.

    requestCachePolicy

    The default caching policy for all http requests that determines when to return a response from the cache. Defaults to useProtocolCachePolicy. See Apple’s documentation for more info.

    cacheMemoryCapacity

    The memory capacity of the cache, in bytes. Defaults to 512KB.

    cacheDiskCapacity

    The disk capacity of the cache, in bytes. Defaults to 10MB.

    migratingFromObjcSDK

    If your app previously used the iOS Objective-C SDK, setting this value to true will attempt to migrate relevant data stored in the Keychain to ParseSwift. Defaults to false.

    deletingKeychainIfNeeded

    Deletes the Parse Keychain when the app is running for the first time. Defaults to false.

    httpAdditionalHeaders

    A dictionary of additional headers to send with requests. See Apple’s documentation for more info.

    maxConnectionAttempts

    Maximum number of times to try to connect to Parse Server. Defaults to 5.

    authentication

    A callback block that will be used to receive/accept/decline network challenges. Defaults to nil in which the SDK will use the default OS authentication methods for challenges. It should have the following argument signature: (challenge: URLAuthenticationChallenge, completionHandler: (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) -> Void. See Apple’s documentation for more for details.