Functions
The following functions are available globally.
-
Appends a
ChildPath
to aPath
yielding a newPath
. This is the mechanism used for generating paths to resources and collections.Here is a version with manually constructed paths:
let parent = Path<Group, SingularPath, GET>(path: "groups/1") let child = ChildPath<User, SingularPath, GET>(path: "users/1") let result = parent / child let path = result.path // "groups/1/users/1"
Generally you wouldn’t do this however. You would use the functions defined on your resources.
let result = Group.show(1) / User.show(1) let path = result.path // "groups/1/users/1"
The various constraints on this function give us the following properties:
- Only
ChildPath
can be appended toPath
, notPath
toPath
orChildPath
toChildPath
- The parent
Path
must point to a single resource, not a collection - The resources for the paths must have a parent/child relationship; see the
associatedtype Parent
declaration inChildResource
.
Declaration
Swift
public func / <P, C, F, M>(lhs: Path<P, SingularPath, GET>, rhs: ChildPath<C, F, M>) -> Path<C, F, M> where P: IsShowable, C: NestedResource, C.Parent == P
- Only