/(_:_:)
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
Appends a ChildPath
to a Path
yielding a new Path
. 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:
-
Undocumented
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