ParseRelation
public struct ParseRelation<T> : Codable where T : ParseObject
The ParseRelation
class that is used to access all of the children of a many-to-many relationship.
Each instance of ParseRelation
is associated with a particular parent object and key.
-
The parent
ParseObject
Declaration
Swift
public var parent: T?
-
The name of the class of the target child objects.
Declaration
Swift
public var className: String?
-
Create a
ParseRelation
with a specific parent and key.Declaration
Swift
public init(parent: T, key: String? = nil, className: String? = nil)
Parameters
parent
The parent
ParseObject
.key
The key for the relation.
className
The name of the child class for the relation.
-
Create a
ParseRelation
with a specific parent and child.Declaration
Swift
public init<U>(parent: T, key: String? = nil, child: U? = nil) where U : ParseObject
Parameters
parent
The parent
ParseObject
.key
The key for the relation.
child
The child
ParseObject
. -
Adds a relation to the respective objects.
Throws
An error of typeParseError
.Declaration
Swift
public func add<U>(_ key: String, objects: [U]) throws -> ParseOperation<T> where U : ParseObject
Parameters
key
The key for the relation.
objects
An array of
ParseObject
‘s to add relation to. -
Removes a relation to the respective objects.
Throws
An error of typeParseError
.Declaration
Swift
public func remove<U>(_ key: String, objects: [U]) throws -> ParseOperation<T> where U : ParseObject
Parameters
key
The key for the relation.
objects
An array of
ParseObject
‘s to remove relation to. -
Returns a
Query
that is limited to objects in this relation.Throws
An error of typeParseError
.Declaration
Swift
public func query<U>(_ child: U) throws -> Query<U> where U : ParseObject
Parameters
child
The child class for the relation.
Return Value
A relation query.
-
Adds a relation to the respective
ParseUser
‘s withkey = "users"
.Throws
An error of typeParseError
.Declaration
Swift
func add<U>(_ users: [U]) throws -> ParseOperation<T> where U : ParseUser
Parameters
users
An array of
ParseUser
‘s to add relation to. -
Adds a relation to the respective
ParseRole
‘s withkey = "roles"
.Throws
An error of typeParseError
.Declaration
Swift
func add<U>(_ roles: [U]) throws -> ParseOperation<T> where U : ParseRole
Parameters
roles
An array of
ParseRole
‘s to add relation to. -
Removes a relation to the respective
ParseUser
‘s withkey = "users"
.Throws
An error of typeParseError
.Declaration
Swift
func remove<U>(_ users: [U]) throws -> ParseOperation<T> where U : ParseUser
Parameters
users
An array of
ParseUser
‘s to add relation to. -
Removes a relation to the respective
ParseRole
‘s withkey = "roles"
.Throws
An error of typeParseError
.Declaration
Swift
func remove<U>(_ roles: [U]) throws -> ParseOperation<T> where U : ParseRole
Parameters
roles
An array of
ParseRole
‘s to add relation to.