ParseRelation
public struct ParseRelation<T> : Codable, Hashable where T : ParseObject
extension ParseRelation: CustomDebugStringConvertible
extension ParseRelation: CustomStringConvertible
The ParseRelation
object 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.
In most cases, you do not need to create an instance of ParseRelation
directly as it can be
indirectly created from any ParseObject
by using the respective relation
property.
-
The parent
ParseObject
Declaration
Swift
public var parent: Pointer<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: Pointer<T>, key: String? = nil)
Parameters
parent
The parent
ParseObject
Pointer.key
The key for the relation.
-
Create a
ParseRelation
with a specific parent, key, and className.Declaration
Swift
public init(parent: Pointer<T>, key: String? = nil, className: String)
Parameters
parent
The parent
ParseObject
Pointer.key
The key for the relation.
className
The name of the child class for the relation.
-
Create a
ParseRelation
with a specific parent, key, and child object.Declaration
Swift
public init<U>(parent: Pointer<T>, key: String? = nil, child: U) where U : ParseObject
Parameters
parent
The parent
ParseObject
Pointer.key
The key for the relation.
child
The child
ParseObject
. -
Create a
ParseRelation
with a specific parent, key, and child object.Declaration
Swift
public init<U>(parent: Pointer<T>, key: String? = nil, child: Pointer<U>) where U : ParseObject
Parameters
parent
The parent
ParseObject
Pointer.key
The key for the relation.
child
The child
ParseObject
Pointer. -
Create a
ParseRelation
with a specific parent and key.Declaration
Swift
public init(parent: T, key: String? = nil) throws
Parameters
parent
The parent
ParseObject
.key
The key for the relation.
-
Create a
ParseRelation
with a specific parent, key, and className.Declaration
Swift
public init(parent: T, key: String? = nil, className: String) throws
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, key, and child object.Declaration
Swift
public init<U>(parent: T, key: String? = nil, child: U) throws where U : ParseObject
Parameters
parent
The parent
ParseObject
.key
The key for the relation.
child
The child
ParseObject
. -
Create a
ParseRelation
with a specific parent, key, and child object.Declaration
Swift
public init<U>(parent: T, key: String? = nil, child: Pointer<U>) throws where U : ParseObject
Parameters
parent
The parent
ParseObject
.key
The key for the relation.
child
The child
ParseObject
Pointer.
-
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. -
Adds a relation to the respective
ParseObject
‘s with using thekey
for thisParseRelation
.Throws
An error of typeParseError
.Declaration
Swift
public func add<U>(_ objects: [U]) throws -> ParseOperation<T> where U : ParseObject
Parameters
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. -
Removes a relation to the respective objects using the
key
for thisParseRelation
.Throws
An error of typeParseError
.Declaration
Swift
public func remove<U>(_ objects: [U]) throws -> ParseOperation<T> where U : ParseObject
Parameters
objects
An array of
ParseObject
‘s to add relation to. -
Declaration
Swift
public static func query<U>(_ key: String, parent: Pointer<U>) -> Query<T> where U : ParseObject
Parameters
key
The key for the relation.
parent
The parent pointer object for the relation.
Return Value
A relation query.
-
Returns a
Query
that is limited to objects for a specifickey
andparent
in this relation.Throws
An error of typeParseError
.Declaration
Swift
public static func query<U>(_ key: String, parent: U) throws -> Query<T> where U : ParseObject
Parameters
key
The key for the relation.
parent
The parent object for the relation.
Return Value
A relation query.
-
Returns a
Query
that is limited to objects for a specifickey
andparent
in this relation.Throws
An error of typeParseError
.Declaration
Swift
public func query<U>(_ key: String, parent: U) throws -> Query<T> where U : ParseObject
Parameters
key
The key for the relation.
parent
The parent object for the relation.
Return Value
A relation query.
-
Declaration
Swift
public func query<U>(_ key: String, parent: Pointer<U>) -> Query<T> where U : ParseObject
Parameters
key
The key for the relation.
parent
The parent pointer object for the relation.
Return Value
A relation query.
-
Returns a
Query
that is limited to the key and objects in this relation.Throws
An error of typeParseError
.Declaration
Swift
public func query<U>() throws -> Query<U> where U : ParseObject
Return Value
A relation query.
-
Returns a
Query
that is limited to objects for a specifickey
andchild
in this relation.Throws
An error of typeParseError
.Declaration
Swift
public func query<U>(_ key: String) throws -> Query<U> where U : ParseObject
Parameters
key
The key 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.
-
Declaration
Swift
public var debugDescription: String { get }
-
Declaration
Swift
public var description: String { get }