One Logo Pool Ball
Foundation · IOS API REFERENCE

PredicateCodableConfiguration

struct · iOS 17.0+ · SDK 27.1

struct PredicateCodableConfiguration

A specification of the expected types and key paths found in an archived predicate. Use this configuration when encoding and decoding a predicate to restrict what that predicate can contain. If a predicate contains data types or keypaths that aren't allowed by the configuration, the encoding or decoding process throws an error. ```swift var configuration = PredicateCodableConfiguration.standardConfiguration configuration.allowType(Message.self, identifier: "MyApp.Message") configuration.allowType(Person.self, identifier: "MyApp.Person") configuration.allowKeyPath(\Message.sender, identifier: "MyApp.Message.sender") configuration.allowKeyPath(\Person.firstName, identifier: "MyApp.Person.firstName") configuration.allowKeyPath(\Person.lastName, identifier: "MyApp.Person.lastName") struct MyRequest: Codable { let predicate: Predicate<Message> func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(predicate, forKey: .predicate, configuration: configuration) } init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) predicate = try container.decode(Predicate<Message>.self, forKey: .predicate, configuration: configuration) } } ```

Members (6)

get · iOS 17.0+

standardConfiguration

TypeScript
static get standardConfiguration(): PredicateCodableConfiguration
Swift declaration
static let standardConfiguration: PredicateCodableConfiguration
method · iOS 17.0+

allowKeyPath

TypeScript
allowKeyPath(keyPath: (SDKHandle) & (SDKHandle), identifier: string): void
Swift declaration
mutating func allowKeyPath(_ keyPath: any AnyKeyPath & Sendable, identifier: String)
method · iOS 17.0+

disallowKeyPath

TypeScript
disallowKeyPath(keyPath: (SDKHandle) & (SDKHandle)): void
Swift declaration
mutating func disallowKeyPath(_ keyPath: any AnyKeyPath & Sendable)
get · iOS 17.0+

debugDescription

TypeScript
get debugDescription(): string
Swift declaration
var debugDescription: String { get }

A textual representation of this instance, suitable for debugging. Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the `String(reflecting:)` initializer. This initializer works with any type, and uses the custom `debugDescription` property for types that conform to `CustomDebugStringConvertible`: struct Point: CustomDebugStringConvertible { let x: Int, y: Int var debugDescription: String { return "(\(x), \(y))" } } let p = Point(x: 21, y: 30) let s = String(reflecting: p) print(s) // Prints "(21, 30)" The conversion of `p` to a string in the assignment to `s` uses the `Point` type's `debugDescription` property.

method · iOS 17.0+

allow

TypeScript
allow(other: PredicateCodableConfiguration): void
Swift declaration
mutating func allow(_ other: PredicateCodableConfiguration)
init · iOS 17.0+

init

TypeScript
static init(): PredicateCodableConfiguration
Swift declaration
init()

Skipped declarations

6 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

PredicateCodableConfiguration.allowType(_:identifier:)

Passing a Swift type itself is not supported.

PredicateCodableConfiguration.disallowType(_:)

Passing a Swift type itself is not supported.

PredicateCodableConfiguration.allowPartialType(_:identifier:)

Passing a Swift type itself is not supported.

PredicateCodableConfiguration.disallowPartialType(_:)

Passing a Swift type itself is not supported.

PredicateCodableConfiguration.allowKeyPathsForPropertiesProvided(by:recursive:)

Passing a Swift type itself is not supported.

PredicateCodableConfiguration.disallowKeyPathsForPropertiesProvided(by:recursive:)

Passing a Swift type itself is not supported.

All Foundation types →